I have a n X 2 matrix, but I want remove the points with a distance smaller than a threshold. And the data is random, which means the data position may be very far in the matrix but their distance is very close. Can anyone help me?

4 views (last 30 days)
I have a n X 2 matrix, but I wanna remove the points with a distance smaller than a threshold. And the data is random, which means the data position may be very far in the matrix but their distance is very close. Can anyone help me with an algorithm to deal with it?
  3 Comments

Sign in to comment.

Accepted Answer

Jan Orwat
Jan Orwat on 7 Jun 2016
dataOut = uniquetol(dataIn, tolerance, 'ByRows', true);
Above code should be a good starting point. In this case it would be 1-norm distance between points against given tolerance. Check uniquetol documentation for more information.
While it is not "Euklidean" 2-norm distance, in many cases should be good enough and it's very simple workaround.
  2 Comments
binbin cui
binbin cui on 7 Jun 2016
Thank you very much. But I just find another algorithm to implement this calculation. I will use the D=pdist() to get all the possible distances.then find the values below the threshold in the D matrix. Use the index of target values to infer their pairing in original matrix.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!