下記のような数値データがあり、一列にならんでいます。※数値データは例で、実際には連番ではありません。 1; 2; 3; 4; 5; 6; 、、、
を 1 2 3; 4 5 6; 、、、 のように3つを一行として取り出し、下に追加していくように並べ替えたいです。ご教示ください。

 採用された回答

madhan ravi
madhan ravi 2023 年 11 月 19 日
編集済み: madhan ravi 2023 年 11 月 19 日

0 投票

a = 1 : 9;
assert(~rem(prod(size(a)), 3), 'not multiples of 3')
reshape(a, 3, [])
reshape(a.', 3, [])
reshape(a, 3, []).'
reshape(a, [], 3)
reshape(a.', [], 3)
reshape(a, [], 3).'

1 件のコメント

H.O
H.O 2023 年 11 月 23 日
ありがとうございます。

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

製品

リリース

R2022b

質問済み:

H.O
2023 年 11 月 19 日

コメント済み:

H.O
2023 年 11 月 23 日

Community Treasure Hunt

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

Start Hunting!