element wise multiplication (beginner)

조회 수: 4 (최근 30일)
Nikola
Nikola 2015년 2월 3일
댓글: Nikola 2015년 2월 3일
c=[1 2 3 4 5 6 7]
and
d=[11 ;12 ;13;14;15;12;22],
f=c.*d wouldn't do the job. I got this: "Error using .* Matrix dimensions must agree."
Sorry i am beginner in matlab. Could you share me a solution, thanks.

채택된 답변

James Tursa
James Tursa 2015년 2월 3일
c is a 1x7 row vector (built with spaces or commas separating the elements)
d is a 7x1 column vector (built with semi-colon separating the elements)
So you need to convert one to the other shape first. E.g.,
c(:) .* d % The (:) notation converts c into a column vector
  댓글 수: 1
Nikola
Nikola 2015년 2월 3일
that was the answer i was looking for. Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by