A = rand(600,12);
B = reshape(A,[30,20,12]);
B = permute(B,[1 3 2]);
B = reshape(B,[30*12,20]);
I created B there as the desired result, but I did it in three steps. The trick is to understand how the elements of an array are stored in memory, in what sequence.
I temporarily converted the array into a 3 dimensional array using reshape, then permute re-orders the elements as I needed. Finally, reshape converts the result into a 360x20 array. Each column of that result is as was desired.
1 Comment
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/506946-converting-a-matrix-sequentially-in-to-single-column#comment_800776
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/506946-converting-a-matrix-sequentially-in-to-single-column#comment_800776
Sign in to comment.