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

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 10일

0 개 추천

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

Eliran Farhi
Eliran Farhi 2020년 4월 10일
Thank you.
Ameer Hamza
Ameer Hamza 2020년 4월 10일
Glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Aerospace Blockset에 대해 자세히 알아보기

태그

질문:

2020년 4월 10일

댓글:

2020년 4월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by