ipermute
Inverse permutation of the dimensions of an array.
c=ipermute(a,order)
Inputs
a Any array.
order A vector of unique positive integers of the same size as the number of dimensions of a , with each of the elements being no greater than the number of dimensions.
Outputs
c An array containing the same elements as a but with the ordering of dimensions specified by the second input as described below.


Description
The output is such that if a is an n -dimensional array, for any vector p of size n ,
    a[p[order[1]],p[order[2]],p[order[3]],...]=c[p[1],p[2],p[3],...]
Example
This example illustrates the fact that ipermute is the inverse of the function permute.
>>a=fix(rand(2,3,4)*100)
>>a
[:,1:3, 1]
    9.0000   17.0000   31.0000
   15.0000   10.0000   24.0000
[:,1:3, 2]
   22.0000   37.0000   86.0000
   27.0000   83.0000    6.0000
[:,1:3, 3]
   72.0000   63.0000   91.0000
   43.0000   21.0000   60.0000
[:,1:3, 4]
   62.0000   75.0000   22.0000
   75.0000   46.0000   29.0000

>>b=permute(a,[2 3 1])
>>b
[:,1:4, 1]
         9        22        72        62
        17        37        63        75
        31        86        91        22
[:,1:4, 2]
        15        27        43        75
        10        83        21        46
        24         6        60        29

>>c=ipermute(b,[2 3 1])
>>c
[:,1:3, 1]
         9        17        31
        15        10        24
[:,1:3, 2]
        22        37        86
        27        83         6
[:,1:3, 3]
        72        63        91
        43        21        60
[:,1:3, 4]
        62        75        22
        75        46        29

>>c-a
[:,1:3, 1]
         0         0         0
         0         0         0
[:,1:3, 2]
         0         0         0
         0         0         0
[:,1:3, 3]
         0         0         0
         0         0         0
[:,1:3, 4]
         0         0         0
         0         0         0