How to reshape/permute array correctly?

8 vues (au cours des 30 derniers jours)
Sophie Mayne
Sophie Mayne le 15 Mai 2018
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!

Réponse acceptée

James Tursa
James Tursa le 15 Mai 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);

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by