Group data based on some given points.

I have data and some points(P). I need to extract the 10 nearest points of the P from the data based on distance. And make groups each P and its nearest elements.
I attached the data set here. How can I do that? Please help me.
Thanks in advance.

4 个评论

I opened your excel file and see this
I don't see P points. I only see columns with some data
Be more specific. Make some simple drawing or something
The P is another set of points. Like
P=[1,7,0.3,...]
I am expecting,
Group1 that contains elements near to the 1 and 1 also.
Group2 that contains elements near to the 7 and 7 also.
(Group1=[0.2,0.3,0.4,0.5,1,1.6,1.8,2,2.1,3]
Group2=[1,2,4,5,6,7,8,9,10,11] etc.)
The points in p want to center (near to center) of the group.
What about this simple construction?
ix = abs(P(i)-data1) < 2; % group1, indices of data1 close to P(i) (smaller than 2)
Thank you Sir for your replies and answers.
I am getting some errors like
" Array indices must be positive integers or logical values.
Error in db (line 12)
ix = abs(P(i)-data1) < 2; "

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by