Rearrange dimensions of N-D array
B = permute(A,order)
B = permute(A,order) rearranges
the dimensions of
A so that they are in the order
specified by the vector
the same values of
A but the order of the subscripts
needed to access any particular element is rearranged as specified
order. All the elements of
be unique, real, positive, integer values.
Create a 3-by-4-by-5 array and permute it so that the first and third dimensions are switched.
A = rand(3,4,5); B = permute(A,[3 2 1]); size(B)
ans = 5 4 3
a generalization of transpose (
.') for multidimensional
This function supports tall arrays with the limitation:
Permuting the tall dimension (dimension one) is not supported.
For more information, see Tall Arrays.
Usage notes and limitations:
Does not support cell arrays for the first argument.
See Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder).