Sort a table by two conditions when one column is not unique

4 visualizaciones (últimos 30 días)
Ray Morris
Ray Morris el 22 de Jul. de 2021
Comentada: Steven Lord el 22 de Jul. de 2021
I need to sort this table by two conditions. I need the maximum F_H_max per POSITION. However the POSITION column is not unique. I also need to retain the vertical coordinate for each max value.

Respuestas (1)

Steven Lord
Steven Lord el 22 de Jul. de 2021
Do you need to sort the table or do you need the maximum value of F_H_max for each value of POSITION? Those are two different things. For the former use sortrows, specifically the "Sort Rows of Table by Variables" example on the documentation page. For the latter use groupsummary, as per the "Summary Statistics" example on the documentation page.
  2 comentarios
Ray Morris
Ray Morris el 22 de Jul. de 2021
I would like to have the position column sorted as shown in the original picture with the exception that the F_H column is a max value.
Steven Lord
Steven Lord el 22 de Jul. de 2021
So you want to sort by F_H_max? Use sortrows.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by