필터 지우기
필터 지우기

how to rotate a 3d matrix ?

조회 수: 15 (최근 30일)
Rabih Sokhen
Rabih Sokhen 2022년 9월 19일
댓글: Matt J 2022년 9월 19일
hy guys
i would like to rotate a 3*3 array
suppose i have A=rand(5,4,3)
i would like to rotate it in a way were A now is (4,5,3)
thank you in advance for your help
best regards

채택된 답변

Matt J
Matt J 2022년 9월 19일
편집: Matt J 2022년 9월 19일
permute(A,[2,1,3])
or
pagetranspose(A)
  댓글 수: 2
Rabih Sokhen
Rabih Sokhen 2022년 9월 19일
이동: Matt J 2022년 9월 19일
hy Matt
thank you for your reply
Is there a way to specify which axis I want to permutate with other axis?
Matt J
Matt J 2022년 9월 19일
Yes, the second argument to the permute command lets you specify exactly how you want the axes reordered.

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

추가 답변 (1개)

Matt J
Matt J 2022년 9월 19일
편집: Matt J 2022년 9월 19일
A=randi(50,5,4,3)
A =
A(:,:,1) = 20 45 46 13 13 33 29 39 49 39 2 7 19 9 40 20 46 3 17 13 A(:,:,2) = 4 19 6 6 23 29 49 49 36 3 14 48 50 30 34 6 43 1 28 41 A(:,:,3) = 50 14 38 31 16 18 30 3 15 23 7 28 7 14 47 19 19 3 49 3
rot90(A) %or imrotate(A,90)
ans =
ans(:,:,1) = 13 39 7 20 13 46 29 2 40 17 45 33 39 9 3 20 13 49 19 46 ans(:,:,2) = 6 49 48 6 41 6 49 14 34 28 19 29 3 30 1 4 23 36 50 43 ans(:,:,3) = 31 3 28 19 3 38 30 7 47 49 14 18 23 14 3 50 16 15 7 19

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by