ipermuteRearranging dimensions
b = ipermute(a, order)a is an array.a according to the order specified by order, such that the i-th dimension of a is moved to the order(i)-th dimension in the new array b.permute. That means, if b = permute(a, order), then ipermute(b, order) gives the same array as a.order should be a permutation of the vector 1:length(order) with length(order) >= ndims(a)ipermute is the inverse operation of permute.a = rand(3,4);
b = permute(a,[3 1 4 2 5]);
c = ipermute(b,[3 1 4 2 5]);
% a and c have the same sizes
size(a),size(c)
% a and c are the same matrices
a - c
ans =
3.0000 4.0000
ans =
3.0000 4.0000 1.0000 1.0000 1.0000
ans =
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000