Find closest values in an array of x and y coordinated compared to a given set of coordinates
Show older comments
Hello all,
I've got two vectors of coordinates
x = linspace(400000,500000,100) and
y = linspace(100000,200000,100)
*********
I've got the given coordinates of a point
x_coord= 406000 and y_coord = 170000 and I'd like to find the position/index of the BOTH vectors x and y that are CLOSER to the given coordinate point.
********
I need an index that would fulfill BOTH the nearest values of x and y and at the end I'd get only one index, not two different indices for vectors x and y.
I know that if I had just one vector, I could use the commands:
[c_x index_x] = min(abs(x_coord-x));
[c_y index_y] = min(abs(y_coord-y));
But I don't need that now.
**********
Any thoughts on that?
Answers (2)
Categories
Find more on Spatial Search in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!