multiply columns of an Array

1 Ansicht (letzte 30 Tage)
Nikolas Spiliopoulos
Nikolas Spiliopoulos am 11 Jan. 2017
Kommentiert: Sean de Wolski am 11 Jan. 2017
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

Akzeptierte Antwort

KSSV
KSSV am 11 Jan. 2017
iwant = bsxfun(@times,A,B)

Weitere Antworten (1)

Alexandra Harkai
Alexandra Harkai am 11 Jan. 2017
bsxfun(@times, A, B)
Or in R2016b:
A * B

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by