Effacer les filtres
Effacer les filtres

配列の並び替え

5 vues (au cours des 30 derniers jours)
H.O
H.O le 19 Nov 2023
Commenté : H.O le 23 Nov 2023
下記のような数値データがあり、一列にならんでいます。※数値データは例で、実際には連番ではありません。 1; 2; 3; 4; 5; 6; 、、、
を 1 2 3; 4 5 6; 、、、 のように3つを一行として取り出し、下に追加していくように並べ替えたいです。ご教示ください。

Réponse acceptée

madhan ravi
madhan ravi le 19 Nov 2023
Modifié(e) : madhan ravi le 19 Nov 2023
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 commentaire
H.O
H.O le 23 Nov 2023
ありがとうございます。

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!