Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

permute

Rearrange dimensions of N-D array

Syntax

B = permute(A,order)

Description

B = permute(A,order) rearranges the dimensions of A so that they are in the order specified by the vector order. B has the same values of A but the order of the subscripts needed to access any particular element is rearranged as specified by order. All the elements of order must be unique, real, positive, integer values.

Examples

collapse all

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

Tips

permute and ipermute are a generalization of transpose (.') for multidimensional arrays.

Extended Capabilities

Introduced before R2006a

Was this topic helpful?