How do I add column vector to a matrix ? Documentation examples does not work.
古いコメントを表示
I copied this example directly from the documentation and it returns error "Matrix dimensions must agree". What is going on? A = [1 2 3; 4 5 6] A =
1 2 3
4 5 6
b = [10; 100] b =
10
100
A + b ans =
11 12 13
104 105 106
採用された回答
その他の回答 (1 件)
dbmn
2016 年 11 月 30 日
hi,
this works like this
A=[A, b]
2 件のコメント
norcalpedaler
2016 年 11 月 30 日
dbmn
2016 年 11 月 30 日
Sorry, i understood that the wrong way.
I might still not fully understand it. Can you give an example of how the output should look like?
Something like this?
sum(A+b)
ans =
115 117 119
Or this?
cumsum(A+b)
ans =
11 12 13
115 117 119
Or this?
cumsum(sum(A+b))
ans =
115 232 351
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!