Finding the 2 closest coordinates for a point

2 次查看(过去 30 天)
I have got a 30 points in the set [-0.5,0.5]^2 in a matrix R generated from the random function. For each point, I need to find the 2 nearest points as well as the row number of the points. What should be done?
  5 个评论
Adam Danz
Adam Danz 2019-6-29
You should copy your comment as an answer, darova. That way the problem will be marked as ansered and you can get credit for your good answer.

请先登录,再进行评论。

采纳的回答

darova
darova 2019-6-29
[D,I] = pdist2(X,Y,'euclidean','Smallest',1);
Im gonna be MVP (Most Valueble Person), maybe MathWorks will start to pay me. Accept my answer please

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Gaussian Process Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by