Hi. Suppose I have a (m*n) matrix A e.g.
A=[8.9505 4.8075 1.6187 0.0020 8.9755 4.7575 1.6187 0.0020 8.9755 4.7825 1.6187 0.0020 8.9755 4.8075 1.6187 0.0020 8.9755 4.8325 1.6187 0.0020 8.9755 4.8575 1.6187 0.0020 9.0005 4.7325 1.6187 0.0020 9.0005 4.7575 1.6187 0.0020 9.0005 4.7825 1.6187 0.0020 9.0005 4.8075 1.6187 0.0020 9.0005 4.8325 1.6187 0.0020 9.0005 4.8575 1.6187 0.0020 9.0255 4.7325 1.6187 0.0020 9.0255 4.7575 1.6187 0.0020 9.0255 4.7825 1.6187 0.0020 9.0255 4.8075 1.6187 0.0020 9.0255 4.8325 1.6187 0.0020 9.0255 4.8575 1.6187 0.0020 9.0505 4.7325 1.6187 0.0020 9.0505 4.7575 1.6187 0.0020 9.0505 4.7825 1.6187 0.0020 9.0505 4.8075 1.6187 0.0020 9.0505 4.8325 1.6187 0.0020 9.0755 4.7575 1.6187 0.0020 9.1255 4.6075 1.6187 0.0020 9.1505 4.5825 1.6187 0.0020 9.1505 4.6075 1.6187 0.0020 9.1755 4.5825 1.6187 0.0020 9.2005 4.5575 1.6187 0.0020];
Imagine that the first column is X coordinates and second column is Y coordinates of some points.
In the matrix A, the first column values varied form minimum value 8.9505 to maximum value 9.2005, and the second column values varied form minimum value 4.5575 to maximum value 4.8575
The middle point of column 1 is :
(8.9505 + 9.2005)/2 = 9.0755
and the middle point of column 2 is:
(4.5575 + 4.8575)/2 = 4.7075
I want to find which one of the rows of matrix A has the nearest values to these values in its first and second columns respectively. Thanks
Best Answer