how can i rotate an N-dimensional matrix?

조회 수: 6(최근 30일)
john creighton
john creighton 2014년 10월 14일
댓글: Andrei Bobrov 2014년 10월 15일
hi all i am having trouble with project and need to figure out how i can rotate an N-dimensional matrix so that i can 'look in from the side'. ie rotate the matrix around a virtical axis. see attached image for discription.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2014년 10월 14일
편집: Andrei Bobrov 2014년 10월 15일
A = cat(3,[1 2 3;4 5 6;7 8 9],[10 11 12;13 14 15;16 17 18])
out = permute(A,[3,1,2]);
Please read about function permute.
  댓글 수: 2
Andrei Bobrov
Andrei Bobrov 2014년 10월 15일
Hi John! You wanted following: [3,6,9;12,15,18] and so on, then:
out = flip(permute(A,[3,1,2]),3);

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Adam
Adam 2014년 10월 14일
doc permute
is the n-dimensional equivalent of translation although I'm not 100% sure what you mean by looking at it from the side as that implies you are visualising the matrix in some way.
  댓글 수: 1
john creighton
john creighton 2014년 10월 14일
hey adam thanks for the quick reply. if i have a 2D matrix of [1 2 3;4 5 6;7 8 9] and a second 2Dmatrix of [10 11 12;13 14 15;16 17 18], i need to be able to view it as another matrix of [3 6 9;12 15 18] and so on...

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by