Remove similar values from matrix with tolerance value

Help me please. I have this matrix, and I want to remove element (32,11) and (32,14) because it is close with (32,12). Can I do that?
Thank you.
Capture.JPG

4 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2019 年 6 月 28 日
You have to explain what is the meaning of close, (32,14) is close to (32,12), what about (37,20), is it close too ?
don't post your data as an image, we can't copy your data for testing
Dina Maulina
Dina Maulina 2019 年 6 月 30 日
Thanks for your reply. This is the data.
X=[32 42; 32 11; 32 12; 62 12; 38 41; 42 42; 33 11; 36 12; 32 36; 32 39; 62 31; 62 36; 32 14; 32 17; 62 16; 62 21]
And what I mean with close is, it has same value in 1st column but has few difference in 2nd column, like [32 11] and [32 12].
Guillaume
Guillaume 2019 年 6 月 30 日
a few difference is not something easy to code. Computers are not able to read your mind or guess what a few difference is. Is 1 a few? Is 10 a few? Is 0.1 a few? Is 1 million a few (it might be compared to the number of atoms in the universe)?
An actual numeric tolerance (relative or absolute), on the other hand, is very easy to code.
Dina Maulina
Dina Maulina 2019 年 6 月 30 日
Yes, I use tolerance right now. And looking for possibility of easier answers.
Anyway, thanks for enlighten me.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2019 年 6 月 28 日

0 投票

Read about pdist2. This will give pairwise distance . Now remove the points which you want to rmove by setting a tolerance in distance.

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

質問済み:

2019 年 6 月 28 日

コメント済み:

2019 年 6 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by