MATLAB中permute的運用



permute:Rearrange dimensions of N-D array


Syntax:B = permute(A,order)

Description:B = permute(A,order) rearrangesthe dimensions of A so that they are in the orderspecified by the vector order. B hasthe same values of A but the order of the subscriptsneeded to access any particular element is rearranged as specifiedby order. All the elements of order mustbe unique, real, positive, integer values.






Examples


Given any matrix A, the statement
permute(A,[2 1]) 


is the same as A.'.


For example:
A = [1 2; 3 4]; permute(A,[2 1])
ans =
     1     3
     2     4


The following code permutes a three-dimensional array:
X = rand(12,13,14);
Y = permute(X,[2 3 1]);
size(Y)
ans =
    13    14    12
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章