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 visualizzazioni (ultimi 30 giorni)
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 Commenti

Accedi per commentare.

Risposta accettata

Jan Orwat
Jan Orwat il 7 Giu 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 Commenti
binbin cui
binbin cui il 7 Giu 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by