help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length
1 回表示 (過去 30 日間)
古いコメントを表示
help I need matlab code that multiply each element in each coulmn by a each element in avector with the same length
0 件のコメント
採用された回答
Star Strider
2015 年 1 月 13 日
編集済み: Star Strider
2015 年 1 月 13 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!