フィルターのクリア

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 Center および File ExchangeFinancial Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by