필터 지우기
필터 지우기

Sort a vector of <1x1 struct>

조회 수: 2 (최근 30일)
Stephen Molnar
Stephen Molnar 2012년 5월 9일
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일
Assuming that the 5 times are a row vector:
[sortedtimes, idx] = sort(min(vertcat(YourStruct.Element),2));
NewStruct = YourStruct(idx);

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by