You are trying to use the wrong tool (i.e., find) to solve this. Well, you could use find, I suppose, with some significant effort. But instead, just use a tool designed to solve that problem.
You apparently want to locate the index of the closest element in a2 to each element in a1. If there is an exact match, that is a great thing, but otherwise, you want the closest match. I'm not sure how you would resolve the case where there are two elements of a2 that are equidistant. I would think that logically, you would choose the first such match from equals.
Regardless, This is a problem solved by knnsearch.
a1 = [2, 3, 4, 5];
a2 = [1, 3, 5, 7, 9, 11];
[idx,D] = knnsearch(a2',a1')
As you can see, knnsearch did exactly that.