配列の並び替え

8 次查看(过去 30 天)
H.O
H.O 2023-11-19
评论: H.O 2023-11-23
下記のような数値データがあり、一列にならんでいます。※数値データは例で、実際には連番ではありません。 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
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 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!