Don't you want to actually INTERSECT A and B? If so, then here's a very fast intersect function that intersects two sets of positive integers only. If you have negative integers you could obviously shift. If you have reals you're SOL. If your integers are greater than ~1e5 the speed gain is negligible.
C = fastintersect(A,B)
P = zeros(1, max(max(A),max(B)) ) ;
P(A) = 1;
C = B(logical(P(B)));
C = ;
Obviously you could leave out the check for emtpy sets if you know you won't have empty sets.