Filter löschen
Filter löschen

How to use Permute?

2 Ansichten (letzte 30 Tage)
Bas
Bas am 9 Sep. 2015
Bearbeitet: John D'Errico am 9 Sep. 2015
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..

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 9 Sep. 2015
reshape(A,size(A,1),12,4)
  1 Kommentar
John D'Errico
John D'Errico am 9 Sep. 2015
Bearbeitet: John D'Errico am 9 Sep. 2015
+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])
:)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by