Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 79 characters in body
Source Link
Sardar Usama
  • 19.7k
  • 9
  • 39
  • 60

‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍Use bsxfun with times like this:

req = bsxfun(@times, A(1,:),A(2:end,:)); 

If you have MATLAB R2016b or later, you can use implicit expansion like this:

req = A(1,:) .* A(2:end,:); 

‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍

Use bsxfun with times like this:

req = bsxfun(@times, A(1,:),A(2:end,:)); 

If you have MATLAB R2016b or later, you can use implicit expansion like this:

req = A(1,:) .* A(2:end,:); 
Post Undeleted by Sardar Usama
Post Deleted by Sardar Usama
Source Link
Sardar Usama
  • 19.7k
  • 9
  • 39
  • 60

‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍ ‍‍‍‍‍‍