配列の並び替え

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

 Risposta accettata

madhan ravi
madhan ravi il 19 Nov 2023
Modificato: madhan ravi il 19 Nov 2023

0 voti

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 Commento

H.O
H.O il 23 Nov 2023
ありがとうございます。

Accedi per commentare.

Più risposte (0)

Categorie

Prodotti

Release

R2022b

Richiesto:

H.O
il 19 Nov 2023

Commentato:

H.O
il 23 Nov 2023

Community Treasure Hunt

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

Start Hunting!