Rearrange dimensions of N-D array
B = permute(A,order)
B = permute(A,order) rearranges the
A so that they are in the order specified by the vector
order. The resulting array
B has the same
A but the order of the subscripts needed to access any
particular element is rearranged as specified by
order. All the
order must be unique, real, positive, integer
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 = 1×3 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).
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).