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行目から最終列までを順番に垂直連結させる方法を知りたいです.

 Akzeptierte Antwort

Kenta
Kenta am 15 Nov. 2019

5 Stimmen

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 Kommentar

Kouki
Kouki am 15 Nov. 2019
1行にできました.
回答ありがとうございます.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 15 Nov. 2019

Kommentiert:

am 15 Nov. 2019

Community Treasure Hunt

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

Start Hunting!