MATLAB Answers

How to put 2 matrices together to make one matrix?

51 ビュー (過去 30 日間)
Carson Fiscus
Carson Fiscus 2019 年 5 月 1 日
Edited: James Tursa 2019 年 5 月 1 日
I'm currently trying to make a 7x2 matrix and a 3x2 matrix into one 10x2 matrix. what I'd like to do is just "stack" the 2 on top of each other.
is there any easy way to do this?

  0 件のコメント

サインイン to comment.

件の回答 (1)

James Tursa
James Tursa 2019 年 5 月 1 日
編集済み: James Tursa 2019 年 5 月 1 日
To stack them vertically,
A = your 7x2 matrix
B = your 3x2 matrix
result = [A;B];
If you had two matrices that you wanted to combine side by side (horizontally), you would use a comma instead of a semi-colon. E.g.,
C = a 4x3 matrix
D = a 4x5 matrix
result = [C,D]; % a 4x8 matrix

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。





Translated by