Clear Filters
Clear Filters

help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length

1 view (last 30 days)
help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length

Accepted Answer

Star Strider
Star Strider on 13 Jan 2015
Edited: Star Strider on 13 Jan 2015
Use bsxfun:
m = rand(10,5);
v = rand(10,1);
vm = bsxfun(@times, v, m);
Here, ‘m’ is the matrix, ‘v’ is the vector, and ‘vm’ is the element-by-element product of the columns of ‘m’ and column vector ‘v’.
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!