permute
Permutation of the dimensions of an array.
c=permute(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 ,
    c[p[order[1]],p[order[2]],p[order[3]],...]=a[p[1],p[2],p[3],...]
Example
>>a=fix(rand(2,3,4)*100)
>>a
[:,1:3, 1]
   53.0000   26.0000    6.0000
   55.0000   20.0000    9.0000
[:,1:3, 2]
   87.0000   45.0000    3.0000
   69.0000   18.0000   40.0000
[:,1:3, 3]
   19.0000    8.0000   51.0000
   88.0000   31.0000   18.0000
[:,1:3, 4]
   73.0000    6.0000    5.0000
   94.0000   70.0000    8.0000

>>permute(a,[2 3 1])
[:,1:4, 1]
        53        87        19        73
        26        45         8         6
         6         3        51         5
[:,1:4, 2]
        55        69        88        94
        20        18        31        70
         9        40        18         8
>>size(permute(a,[2 3 1]))
          3          4          2

>>size(a)
          2          3          4