Reduce size of multidimensional array

10 visualizaciones (últimos 30 días)
Early Social Development Lab Lab
Early Social Development Lab Lab el 8 de Feb. de 2021
Comentada: James Tursa el 9 de Feb. de 2021
Hello,
I have a multidimensional array size = 220 x 46 x 10 x 4 x2 . I would like to combine all of the data in the third dimension so that way I end up with a 4-dimesional array. Any help is greatly appreciated.
Take care and stay well!

Respuesta aceptada

James Tursa
James Tursa el 8 de Feb. de 2021
One way using summing:
result = squeeze(sum(your_array,3));
  7 comentarios
Early Social Development Lab Lab
Early Social Development Lab Lab el 9 de Feb. de 2021
Yes! Thank you! I did not realize the arrays had to be next to eachother before applying the reshape function!
James Tursa
James Tursa el 9 de Feb. de 2021
Yes. Reshape does not change the order of the data in memory. You will often need to use another function first such as permute or transpose etc. to rearrange the data in memory before applying the reshape.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by