MATLAB: Finding rows with the closest values in two matrices matlab

MATLAB

I have two matrices with the same size [n,2]. One is the control matrix A and another is the test matrix B. In general, Numbers in B have close values to numbers in A. However, the each matched numbers in B is randomly distributed. The matched index need to be found to sort matrix B in the same sequence as A. How can I achieve it efficiently? For example:
A=
[-0.9 235.6
0.0 0.0
-0.2 76.8
-0.4 153.5
-0.7 312.7
-0.5 389.4
-0.6 466.6
0.1 548.7
0.1 625.5
0.7 702.6
0.8 779.3
1.4 861.1
2.2 938.0
3.2 1014.4];
B=
[
-1.037 312.275
-0.839 235.292
-0.826 389.108
-1.071 466.333
-0.542 548.430
-0.635 625.385
0.000 0.000
-0.210 76.612
-0.386 153.425
-0.302 702.214
0.147 779.087
0.522 860.808
1.355 937.624
1.928 1014.046];
I know I can use loop to solve this issue, but my matrix is quite big, the loop will be time-consuming. I also know that knnsearch can solve this problem, however, I can not use the statistical tool box. Does anyone have other good suggestions? Highly appreciate.

Best Answer

this method doesn't work because all the numeric data are generated from some images. Since the images are not always same/aligned, the data can not be simply sorted in matrix A and B to match each other.