Sort a vector of <1x1 struct>
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 5월 9일
Assuming that the 5 times are a row vector:
[sortedtimes, idx] = sort(min(vertcat(YourStruct.Element),2));
NewStruct = YourStruct(idx);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!