What is the difference between knnsearch and rangesearch?

조회 수: 3 (최근 30일)
Atiqah Zakirah
Atiqah Zakirah 2017년 5월 15일
답변: KSSV 2017년 5월 15일
I need to find the number of data points within a circle of a 10 km radius. The data would be the latitude and longitude coordinates of my location point. Which function would be the best approach?

채택된 답변

KSSV
KSSV 2017년 5월 15일
difference is:
knnsearch: For a given positive integer K, knnsearch finds K points in X that are nearest each Y point.
rangesearch: for a given positive real value r, rangesearch finds all the X points that are within a distance r of each Y point.
So in your case if you want all the points (lat,lon) which are in a radius 10 kms, you have to use rangesearch

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by