How to reorder matrix from one column to MxN matrix
3 views (last 30 days)
Show older comments
I have a matrix 1x15 --> A = [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15]
And I want to change the order into matrix 3x5 --> A = [1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15]
Any idea how to do this? i have tried reshape but didn't work well. thank you.
0 Comments
Accepted Answer
Voss
on 4 May 2022
A = [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15];
reshape(A,5,[]).' % reshape to 5x3, then transpose to 3x5
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!