Remove duplicate points by Uniquetol

7 ビュー (過去 30 日間)
zongxian
zongxian 2021 年 11 月 21 日
回答済み: Matt J 2021 年 11 月 21 日
I have some coordinates stored in a matrix, I only want to keep unique values within tolerance.
Obviously, the values in the first column are all approximately zero, so the final can be approximated as (0, 32.5) and (0, 38.5).
When I use Uniquetol, it will returen all the coordinates, so I need someone help me, how could it only return two point.
xy=[-9.63493432264607e-181 32.5216944525841
-7.62762965035320e-181 32.5216944525841
-6.03851901161367e-181 32.5216944525841
-4.78047749105533e-181 32.5216944525841
-3.78453143867467e-181 32.5216944525841
2.93858785517212e-181 38.5303300098731
3.71191343625312e-181 38.5303300098731
4.68874916704828e-181 38.5303300098731
5.92265124956345e-181 38.5303300098731
7.48126985987569e-181 38.5303300098731
9.45005815096910e-181 38.5303300098731
1.19369573253412e-180 38.5303300098731];
uniquetol(xy, 'ByRows', true)
ans = 12×2
-0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303
uniquetol(xy, 1e-12, 'ByRows', true) % or
ans = 12×2
-0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 -0.0000 32.5217 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303 0.0000 38.5303

採用された回答

Matt J
Matt J 2021 年 11 月 21 日
uniquetol(xy, 1, 'ByRows', true,'DataScale',[1,1]) % or

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by