Working in Matlab I have 2 vectors of x coordinate with different length. For example:
xm = [15 20 24 25 26 35 81 84 93]; xn = [14 22 26 51 55 59 70 75 89 96
It looks like your input vectors are sorted. Use a binary search to find the closest match. This will give you a O(n ln n) run time.