I need to do something like the following and am wondering if there's a faster way. mat1 is likely to be fixed size ~2000×2 or so but mat2 might get really big ~1e6?x2. So the thing only runs code if there is a pair (x,y) match between mat1 and mat2. Thoughts?
n1 = 50; n2 = 500;mat1 = rand([n1, 2]);mat2 = rand([n2, 2]);for ii = 1:size(mat1, 1) if ismember(mat1(ii, :), mat2, 'rows') do my stuff endend
Best Answer