MATLAB: Find matching values in matrix B for multiple values in matrix A.

findmatchrowfun

I have a 18×2 doubles matrix with values in the first column I want to match to values in the first column of a 74×9 double matrix. I need to keep as variables the row in each matrix that contains the matching values, as well as the original value I tried to match. It needs to work something like this:
A= B=
[1 [3
2 2
3] 1]
This script needs to be run for every value in the column. the three rounds of output should return
A = 1, Arow= 1, Brow=3
A = 2, Arow= 2, Brow=2
A = 3, Arow= 3, Brow=1
Right now I have:
[brow,~] = rowfun(find(abs(A(:,1)-B(:,4) <=2e-2)),A);
but I'm getting an error using the subtraction operator here, so I know it's not pulling single values from A like I want it to. I think I'm approaching this incorrectly, so I don't necessarily need to correct the error, just make it work.

Best Answer

Arow = (1:numel(A))';
[~,Brow] = ismember(A,B);