For rows and 2 columns, containing xOy coordinates of the point. Look for the two points with the furthest distance and return the row index of those two points.
2 次查看(过去 30 天)
显示 更早的评论
Please, Can y help me :
For rows and 2 columns, containing xOy coordinates of the point. Look for the two points with the furthest distance and return the row index of those two points.
0 个评论
回答(1 个)
Chunru
2021-10-23
n = 8;
xy = rand(n, 2);
d = pdist(xy);
D = squareform(d)
[~, idx]= max(D(:));
[i, j] = ind2sub([n n], idx)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!