No BSD License  

Highlights from
intersect sets

from intersect sets by Nick
Intersection of two sets of positive integers (works much faster than built-in intersect)

my_intersect(A,B)
function C = my_intersect(A,B)
% MYINTERSECT Intersection of two sets of positive integers (much faster than built-in intersect)
% C = my_intersect(A,B)

% 
A = A(:)'; B = B(:)';
if isempty(A) | isempty(B)
  C = [];
  return
else
  bits = zeros(1, max(max(A),max(B)));  %bits = sparse(1, max(ma,mb));
  bits(A) = 1;
  C = B(logical(bits(B)));  
end

Contact us at files@mathworks.com