row vector and column vector addition

44 ビュー (過去 30 日間)
Mike Pesselse
Mike Pesselse 2019 年 8 月 30 日
編集済み: Stephen23 2019 年 8 月 30 日
I dont understand why I'm able to add rowvector w to columnvector v. I should get an error right?
w = [1 2 3];
v = [4;5;6];
x = v + w
x =
5 6 7
6 7 8
7 8 9

採用された回答

Stephen23
Stephen23 2019 年 8 月 30 日
編集済み: Stephen23 2019 年 8 月 30 日
"I should get an error right?"
Not since R2016b:
The documentation explains what size arrays can be used together with such operators:
Note also that the plus documentation includes links to that second page (the links are within the descriptions of both of the input arguments). This is why it is strongly recommended to read the documentation for all operators that you use, no matter how trivial you may think that operator is: reading the documentation significantly reduces surprises.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParticle Swarm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by