【繰り返し】行列の連結

25 views (last 30 days)
Kouki
Kouki on 15 Nov 2019
Commented: Kouki on 15 Nov 2019
A=[1 2 3 4 5 ; 6 7 8 9 10 ; 11 12 13 14 15 ; 16 17 18 19 20]
このような5×4の行列Aを
B=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
1×20の行列Bのように垂直連結したいです.
列数が多い場合に繰り返しで、1行目から最終列までを順番に垂直連結させる方法を知りたいです.

Accepted Answer

Kenta
Kenta on 15 Nov 2019
A=[1 2 3 4 5 ; 6 7 8 9 10 ; 11 12 13 14 15 ; 16 17 18 19 20];
A =A';
B = A(:)
% 必要に応じて、B'と入力
この場合だと、このようにすれば、1列(行)に連結できます。
  1 Comment
Kouki
Kouki on 15 Nov 2019
1行にできました.
回答ありがとうございます.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!