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.60.0 0.0-0.2 76.8-0.4 153.5-0.7 312.7-0.5 389.4-0.6 466.60.1 548.70.1 625.50.7 702.60.8 779.31.4 861.12.2 938.03.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.3850.000 0.000-0.210 76.612-0.386 153.425-0.302 702.2140.147 779.0870.522 860.8081.355 937.6241.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