필터 지우기
필터 지우기

配列の並び替え

조회 수: 5 (최근 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!