column wise reshaping of the 3rd dimension?

1 view (last 30 days)
Asl
Asl on 21 Oct 2013
Edited: James Tursa on 16 Jan 2018
I have a 3d matrix A
A(:,:,1) =
1 2 ;
3 4
A(:,:,2) =
100 200 ;
300 400
A(:,:,3) =
1000 2000 ;
3000 4000
I want to reshape the data in such a way:
1 100 1000 2 200 2000 3 300 3000 4 400 4000
(Column wise reshaping of 3rd dimension)
Following code do row wise reshaping of 3rd dimension
AA =reshape(A ,[size(A,1)*size(A,2) size(A,3)]);
AA2=AA(:);
How I can do column wise reshaping?
Thanks

Answers (1)

Cedric
Cedric on 21 Oct 2013
Edited: Cedric on 21 Oct 2013
>> AA = reshape( permute(A, [3,2,1]), 1, [] )
AA =
1 100 1000 2 200 2000 3 300 3000 4 400 4000

Categories

Find more on Matrices and Arrays 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!