Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Working With Matrices

5 ビュー (過去 30 日間)
Euan
Euan 2011 年 11 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a matrix and a vector
A= 1 2 3
4 5 6
B=[10 20 30]
Im trying to calculate
C= 1*10 2*20 3*30
4*10 5*20 6*30
Could anyone help me do this? Thanks

回答 (1 件)

Jan
Jan 2011 年 11 月 23 日
A = [1 2 3; 4 5 6];
B = [10 20 30];
C = bsxfun(@times, A, B)
Or:
C = A .* B(ones(1, 2), :)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by