필터 지우기
필터 지우기

Remove coordiantes with less than n repeats in y coordinate

조회 수: 1 (최근 30일)
Jason
Jason 2019년 10월 22일
댓글: Jason 2019년 10월 22일
Hello.
I have a set of x,y coordiantes:
I want to remove all corrdinates in which there are less than 'n' repeats in the y coordinate, Im sorry, but for once, I don't know where to start.
coords=[x,y]
2.00 2.00
44.53 2.00
75.00 2.00
20.00 3.00
24.00 3.00
29.00 3.00
54.00 3.00
69.00 3.00
33.00 4.00
79.00 5.00
2.00 6.00
60.00 6.00
47.00 7.00
63.00 7.00
71.00 7.00
34.44 8.00
41.00 8.00
50.00 8.00
53.48 8.00
68.00 8.00
22.51 9.00
so if n=5, i.e. keep only coordinates in which the y value is repeated at least 5 times would give.
20.00 3.00
24.00 3.00
29.00 3.00
54.00 3.00
69.00 3.00
34.44 8.00
41.00 8.00
50.00 8.00
53.48 8.00
68.00 8.00
Thanks

채택된 답변

Matt J
Matt J 2019년 10월 22일
편집: Matt J 2019년 10월 22일
G=findgroups(y);
[C,~,idx]=histcounts(y, 1:max(G)+1);
keep=C(idx)>=n;
coords=coords(keep,:)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by