multiply columns of an Array

1 次查看(过去 30 天)
Hi all, I am a beginner in Matlab and I am struggling with something.
Lets say I have: A= [1 2 1;3 1 1]; B= [1; 2]
i need to multiply the columns of A with B elements and get this result : c= [1*1 2*1 1*1 ; 3*2 1*2 1*2]
any ideas?
Thanks in Advance!
Nikolas

采纳的回答

KSSV
KSSV 2017-1-11
iwant = bsxfun(@times,A,B)

更多回答(1 个)

Alexandra Harkai
Alexandra Harkai 2017-1-11
bsxfun(@times, A, B)
Or in R2016b:
A * B

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by