%% 3-D Array
% Create a 4-by-3-by-2 array B, and compute its inverse permutation according to the dimension order [3 1 2].

rng default
B = rand(4,3,2)
A = ipermute(B,[3 1 2])

% The inverse permutation A is the array such that, when you permute it using the same dimension order, the result is equal to the original array B.

C = permute(A,[3 1 2])

%
% Copyright 2012 The MathWorks, Inc.