Section: Array Generation and Manipulations
ipermute
function rearranges the contents of an array according
to the inverse of the specified permutation vector. The syntx for
its use is
y = ipermute(x,p)
where p
is a permutation vector - i.e., a vector containing the
integers 1...ndims(x)
each occuring exactly once. The resulting
array y
contains the same data as the array x
, but ordered
according to the inverse of the given permutation. This function and
the permute
function are inverses of each other.
--> A = randn(13,5,7,2); --> size(A) ans = <uint32> - size: [1 4] Columns 1 to 4 13 5 7 2 --> B = permute(A,[3,4,2,1]); --> size(B) ans = <uint32> - size: [1 4] Columns 1 to 4 7 2 5 13 --> C = ipermute(B,[3,4,2,1]); --> size(C) ans = <uint32> - size: [1 4] Columns 1 to 4 13 5 7 2 --> any(A~=C) ans = <logical> - size: [1 1] 0