Sort a vector of <1x1 struct>

10 visualizaciones (últimos 30 días)
Stephen Molnar
Stephen Molnar el 9 de Mayo de 2012
I have a vector of <1x1 struct> each structure contains an element containing five sequential times. I would like to sort the vector by the first time in each individual <1x1 struct>.
Thanks in advance.

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Mayo de 2012
Assuming that the 5 times are a row vector:
[sortedtimes, idx] = sort(min(vertcat(YourStruct.Element),2));
NewStruct = YourStruct(idx);

Categorías

Más información sobre Structures 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