Small Problem with + sign

Matlab complains constantly on the plus or minus sign, why? Here is my problem:
Matlab says:
Error using + Matrix dimensions must agree.
And here is what I wrote:
A=[3 5 2; 2 1 7];
B=[2 1 3; 5 9 0];
>>a=A+B

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 5 月 2 日

0 投票

A and B apparently aren't what you think they are!
size(A);
size(B);
or if this is burried somewhere -
dbstop if error
And then run, inspect A, B at the line of failure.

1 件のコメント

Regina
Regina 2012 年 5 月 2 日
you're right. thanks!

この質問は閉じられています。

質問済み:

2012 年 5 月 2 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by