MATLAB: Transposing 3 D matrix using permute – how does permute work

3d matrixmatrix traspose

Ok. So I see how to transpose all the "2D slices" of a 3D matrix on other answers (permute(A, [2 1 3])).
But what does the order vector mean? The 2 means what? The second row, column? Anyone who can explain this, I appreciate it.
Thanks

Best Answer

It is the dimension number. In [2 1 3] it means that the second dimension of the original should become the first dimension of the new array, and the first dimension of the original should become the second dimension of the new array, and the third dimension of the original should stay where it is.