How shall I sort along a dimension?

1 visualización (últimos 30 días)
alpedhuez
alpedhuez el 15 de Jul. de 2022
Comentada: alpedhuez el 15 de Jul. de 2022
I have a three dimensional array where the first dimension is month the second dimension is city, and the third dimension is temperature of days in that month. I want to sort so thta the array will have, for each month, for each city, the temperature of the day in the descending order. How shall I sort?

Respuesta aceptada

Rik
Rik el 15 de Jul. de 2022
The sidebar showed this thread to me. It probably showed you a similar one before you posted this question.
The solution is similar: use the second and third input of the sort function:
sorted_data=sort(data,3,'descend')

Más respuestas (1)

Torsten
Torsten el 15 de Jul. de 2022
sort(A,3,'descend')

Categorías

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

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by