multiply columns of an Array

조회 수: 1 (최근 30일)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2017년 1월 11일
댓글: Sean de Wolski 2017년 1월 11일
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