How to reshape/permute array correctly?

8 visualizzazioni (ultimi 30 giorni)
I cannot seem to apply the examples in the 'reshape' documentation and/or the answers given in this forum to this many dimensions.
I have an array of 1440x2x8x703x2 and wish to combine the 1440 and 703 dimensions so that I have: 1012320x2x8x2 instead. Should I use a loop or reshape/permute for this? If someone could explain how to use the latter, I would greatly appreciate it, as the documentation is rather confusing!

Risposta accettata

James Tursa
James Tursa il 15 Mag 2018
E.g.,
x = your array
y = permute(x,[1 4 2 3 5]); % Or permute(x,[4 1 2 3 5]) depending on order that you want
result = reshape(y,1012320,2,8,2);

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by