# Transposing 5x5x5 matrix

31 views (last 30 days)
Özgür Alaydin on 24 Sep 2020 at 16:04
Commented: Özgür Alaydin on 24 Sep 2020 at 17:43
Hello all,
I am trying to transpose 5x5x5 matrix but then i get a warning and it says "use permute".
When use function like : permute(r,[5,5,5]) (r is 5x5x5 matrix).
I have this error:
Error using permute
ORDER contains an invalid permutation index.
How can i transpose this matrix? I need to transpose thise matrix and multply it with another 5x5x5 matrix. I have added the matrix.
Thanks for help

Stephen Cobeldick on 24 Sep 2020 at 17:37
new = permute(r,[2,1,3])

#### 1 Comment

Özgür Alaydin on 24 Sep 2020 at 17:43
Thanks :)

Ameer Hamza on 24 Sep 2020 at 16:09
Edited: Ameer Hamza on 24 Sep 2020 at 16:11
You need to specify the order of the dimensions after transpose. It should be something like this
permute(r, [2, 3, 1])
It means that after permute, the dimension which was at 2nd location will move to the 1st location, 3rd to 2nd, and 1st to the 3rd location.
For example, transpose is equivalent to
permute(M, [2 1]); % M is 2D matrix, this command is equivalent to transpose

Özgür Alaydin on 24 Sep 2020 at 16:18
I need element wise
Ameer Hamza on 24 Sep 2020 at 16:24
Yes, then permute will return 5x5x5 matrix. You can then do element-wise multiplication.
Özgür Alaydin on 24 Sep 2020 at 17:27
But permute(r,[5,5,5]) is not working. How can i do it?