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 Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by