FUNCTION REFERENCE

permute

Reorder array dimensions.

Reorder array dimensions.

Syntax

permute(A, ORDER)

ORDER must be a permutation containing at least two indices. [1 2] preserves the array; [2 1] transposes without conjugation. Trailing singleton dimensions are accepted when the result remains 2-D.

Example

permute([1 2; 3 4], [2 1])   % [1 3; 2 4]

Example

size(permute(ones(2,3),[3 1 2]))   % [1 2 3]

Differences from MATLAB: Numeric, logical, char and complex N-D inputs and results, also from a 2-D input; cell and struct arrays stay 2-D.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.