【繰り返し】行列の連結

24 visualizzazioni (ultimi 30 giorni)
Kouki
Kouki il 15 Nov 2019
Commentato: Kouki il 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行目から最終列までを順番に垂直連結させる方法を知りたいです.

Risposta accettata

Kenta
Kenta il 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 Commento
Kouki
Kouki il 15 Nov 2019
1行にできました.
回答ありがとうございます.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!