Clear Filters
Clear Filters

Switch elements of the 2nd and 3d dimension in 3D matrix

7 views (last 30 days)
Consider a 3D array of dimensions i X j X k in the form:
Which is formed by repeating the i X j matrix for k times. I would like to switch the elements without using a loop to have a new iXkXj matrix of the form:

Accepted Answer

michio
michio on 11 Sep 2016
Have you tried permute function? http://www.mathworks.com/help/matlab/ref/permute.html I am guessing
B = permute(A,[1,3,2])
would do the job, where A is your original 3D matrix.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!