This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

ipermute

Inverse permute array dimensions

Syntax

A = ipermute(B,dimorder)

Description

example

A = ipermute(B,dimorder) rearranges the dimensions of an array B in the order specified by the vector dimorder such that B = permute(A,dimorder).

Examples

collapse all

Create a 4-by-3-by-2 array B, and compute its inverse permutation according to the dimension order [3 1 2].

rng default
B = rand(4,3,2)
B = 
B(:,:,1) =

    0.8147    0.6324    0.9575
    0.9058    0.0975    0.9649
    0.1270    0.2785    0.1576
    0.9134    0.5469    0.9706


B(:,:,2) =

    0.9572    0.4218    0.6557
    0.4854    0.9157    0.0357
    0.8003    0.7922    0.8491
    0.1419    0.9595    0.9340

A = ipermute(B,[3 1 2])
A = 
A(:,:,1) =

    0.8147    0.9572
    0.6324    0.4218
    0.9575    0.6557


A(:,:,2) =

    0.9058    0.4854
    0.0975    0.9157
    0.9649    0.0357


A(:,:,3) =

    0.1270    0.8003
    0.2785    0.7922
    0.1576    0.8491


A(:,:,4) =

    0.9134    0.1419
    0.5469    0.9595
    0.9706    0.9340

The inverse permutation A is the array such that, when you permute it using the same dimension order, the result is equal to the original array B.

C = permute(A,[3 1 2])
C = 
C(:,:,1) =

    0.8147    0.6324    0.9575
    0.9058    0.0975    0.9649
    0.1270    0.2785    0.1576
    0.9134    0.5469    0.9706


C(:,:,2) =

    0.9572    0.4218    0.6557
    0.4854    0.9157    0.0357
    0.8003    0.7922    0.8491
    0.1419    0.9595    0.9340

Input Arguments

collapse all

Input array, specified as a vector, matrix, or multidimensional array.

Dimension order, specified as a row vector with unique, positive integer elements representing the dimensions of the input array.

Extended Capabilities

Introduced before R2006a