フィルターのクリア

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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by