Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the 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

Given any matrix A, the statement

permute(A,[2 1]) 

is the same as A.'.

For example:

A = [1 2; 3 4]; permute(A,[2 1])
ans =
     1     3
     2     4

The following code permutes a three-dimensional array:

X = rand(12,13,14);
Y = permute(X,[2 3 1]);
size(Y)
ans =
    13    14    12

More About

collapse all

Tall Array Support

This function supports tall arrays with the limitation:

Permuting the tall dimension (dimension one) is not supported.

For more information, see Tall Arrays.

Tips

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

Introduced before R2006a

Was this topic helpful?