sorting sturctured variable
이전 댓글 표시
hi guys, I need a way to sort the structured variable based on the size of the elements present in those respective structures.
CC=bwconncomp(imstack,26);
stats = regionprops(CC,'pixellist');
statss(8846,1)=0;
for i=1:8846
statss(i,1) = size(stats(i,1).PixelList,1);
end
statss=sort(statss,1);
statss gives the number on which the respective stats should be sorted...What matlab commands can i use to sort structure?
채택된 답변
추가 답변 (1개)
Walter Roberson
2011년 10월 4일
Replace
statss=sort(statss,1);
with
[statss, statidx] = sort(statss,1);
sortedstats = stats(statidx);
카테고리
도움말 센터 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!