grouping struct array based on two different field thresholds

조회 수: 1 (최근 30일)
sepideh
sepideh 2014년 6월 27일
댓글: Geoff Hayes 2014년 6월 27일
I have a very big struct array with some fields. I want to group it to a new struct array based on just 2 fields as below (this is just for the first group. after grouping each one the remaining stand the original struct and it iterated until grouping all of them): m=2; b(new).alfa(1)=a.alfa(1); b(new).Distance(1)=a.Distance(1); for i=1:size(a.alfa,1) if ((a.alfa(1)-a.alfa(i))<threshold1) & (a.Distance(1)-a.Distance(i))<threshold2)) b(new).alfa(m)=a.alfa(i); b(new).Distance(m)=a.Distance(i); m=m+1; end end
it is a correct way but very slow one. I wanna a very fast tricky way. Thanks in advance
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 6월 27일
Sepideh - please format the code in your question so that it is readable. Highlight the code portion and press the Code {} button.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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