Sort a vector of <1x1 struct>

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.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 9일

0 개 추천

Assuming that the 5 times are a row vector:
[sortedtimes, idx] = sort(min(vertcat(YourStruct.Element),2));
NewStruct = YourStruct(idx);

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2012년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by