array rearrangement
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have an array of MxN numbers, and I want to rearrange it so that the numbers are all in one column:
1 2 4 5 3 6 7 8
becomes
1 3 2 6 4 7 5 8
How can I do this for an array of any size?
Thanks,
Richard
0 件のコメント
採用された回答
Sean de Wolski
2011 年 4 月 8 日
A = A(:); %column-wise extractivon
or for more fancy manipulations:
doc permute
doc transpose
doc reshape
1 件のコメント
Walter Roberson
2011 年 4 月 8 日
Right general principle, but the code would have to be
reshape(A.',[],1)
or
reshape(A.', numel(A), 1)
or
A = A.';
A(:)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!