Compare two set of coordinates

4 vues (au cours des 30 derniers jours)
Eliran Farhi
Eliran Farhi le 10 Avr 2020
Commenté : Ameer Hamza le 10 Avr 2020
I have two sets of points, defined by X-Y coordinates.
I want to find how many points from the first set, are close (less than a given number - "radius") to points from the second set.
For example: set A={(1,2), (3, 6), (4,8), (7,10)}
set B={(1,3), (7,9), (3,5), (5,10)}
if the radius is than the answer will be: 3

Réponse acceptée

Ameer Hamza
Ameer Hamza le 10 Avr 2020
Something like this?
A=[1 2;
3 6;
4 8;
7 10];
B=[1 3;
7 9;
3 5;
5 10];
radius = 2;
result = sum(any(pdist2(A,B) < radius, 1));
  2 commentaires
Eliran Farhi
Eliran Farhi le 10 Avr 2020
Thank you.
Ameer Hamza
Ameer Hamza le 10 Avr 2020
Glad to be of help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by