Can you use the concatenation ability of MATLAB to combine a 3x4 and a 3x5 matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
If yes, how we can do this?
1 件のコメント
採用された回答
OCDER
2017 年 8 月 31 日
Yes you can, as long as the row or column dimensions matches.
A = zeros(3, 4) % A 3x4 matrix
B = ones(3, 5) % a 3x5 matrix
AB = cat(2, A, B) %Concatenate along column dimension (dim = 2), resulting in a 3x9 matrix
AB = [A B] %Same thing as cat(2, A, B)
0 件のコメント
その他の回答 (1 件)
Omur Bas
2017 年 8 月 31 日
Simply use square brackets, as you would use for combining scalars into a vector:
A = ones(3,4);
B = zeros(3,5);
AB= [A B];
0 件のコメント
参考
カテゴリ
Help Center および 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!