Vector Matrix multiplication (Row wise)
古いコメントを表示
Hi, I need to multiply each row of very large matrix with a row of corresponding vector. I don't really want to use for loop for that, i.e.,
N=15000;
L=rand(N,N); V=rand(N,1);
for i=1:1:N
L(i,:)=V(i)*L(i,:);
end
is it possible to do this in vectorized way?
Thank you
Erdem
採用された回答
その他の回答 (3 件)
Vladimir Kazei
2017 年 10 月 9 日
編集済み: Vladimir Kazei
2017 年 10 月 9 日
2 投票
L = L .* V;
James Tursa
2015 年 9 月 16 日
L = bsxfun(@times,L,V);
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!