Permute doesn't work as expected

I'm trying to use the permute function. I understand you are supposed to give it the order of dimensions you need to get it to change the order of dimensions in an array. But I get unexpected error.
clc
temp = zeros(3,4,7);
size(temp)
temp = permute(temp,[3,1,2]);
size(temp) % 4 x 7 x 3
I expect the resulting array to be 4 x 7 x 3, but I get
ans =
3 4 7
ans =
7 3 4
What is going on??

回答 (1 件)

KSSV
KSSV 2021 年 2 月 5 日

0 投票

temp = zeros(3,4,7);
size(temp)
% temp = permute(temp,[3,1,2]);
temp = permute(temp,[2,3,1]);
size(temp) % 4 x 7 x 3

カテゴリ

ヘルプ センター および File ExchangeArduino Hardware についてさらに検索

タグ

質問済み:

2021 年 2 月 5 日

回答済み:

2021 年 2 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by