How do I swap the dimensions of a 3D matrix?

49 views (last 30 days)
For example, I have a 3D array A so that size(A) = [5, 2, 20]; How could I make it like [20, 2, 5] or [2, 5, 20], any order?
Edit: I didn't make it clear initially. A is 3-D, like a dice, I don't want to cut the dice and rearrange the data, instead I just want to roll the dice, so that I'm looking at this same dice just from a different angle.

Accepted Answer

Walter Roberson
Walter Roberson on 28 Mar 2017
permute(A, [3 2 1])

More Answers (0)

Categories

Find more on Structures 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!