How to use Permute?

3 ビュー (過去 30 日間)
Bas
Bas 2015 年 9 月 9 日
編集済み: John D'Errico 2015 年 9 月 9 日
Hello,
I have a matrix A(2362x48) and I want to convert this into a 3D matrix B(2362X12X4). So I want all the rows of columns 1:12 of matrix A to be in B(:,:,1) and all rows of columns 13:24 of A in B(:,:,2) etc. Can anyone help me with this? I tried permute but get different matrices all the time..

採用された回答

Sean de Wolski
Sean de Wolski 2015 年 9 月 9 日
reshape(A,size(A,1),12,4)
  1 件のコメント
John D'Errico
John D'Errico 2015 年 9 月 9 日
編集済み: John D'Errico 2015 年 9 月 9 日
+1. An excellent use for permute. :)
I suppose IF the OP INSISTS on using permute here, then this is an option:
permute(reshape(A,size(A,1),12,4),[1 2 3])
:)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by