combining 5 rows into one matrix

4 ビュー (過去 30 日間)
Fadi Lama
Fadi Lama 2020 年 12 月 6 日
回答済み: VBBV 2022 年 7 月 20 日
How do I combine 5 different (1x10) vectors into a single matrix of dimension 5x10

回答 (2 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 6 日
mat1=1:10;
mat2=11:20;
mat3=21:30;
mat4=31:40;
mat5=41:50;
% Combine using square brackets and transpose to make 5x10
newMat = [mat1; mat2; mat3; mat4; mat5]'
newMat = 10×5
1 11 21 31 41 2 12 22 32 42 3 13 23 33 43 4 14 24 34 44 5 15 25 35 45 6 16 26 36 46 7 17 27 37 47 8 18 28 38 48 9 19 29 39 49 10 20 30 40 50
  1 件のコメント
Fadi Lama
Fadi Lama 2020 年 12 月 6 日
Thanks!

サインインしてコメントする。


VBBV
VBBV 2022 年 7 月 20 日
mat1=1:10;
mat2=11:20;
mat3=21:30;
mat4=31:40;
mat5=41:50;
% transpose is not required to make 5x10
newMat = [mat1; mat2; mat3; mat4; mat5]
newMat = 5×10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
transpose is not necessary

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by