clc;cleara=[1,2,3,4,4,7,8];b=[1,5,7,4,3,2];c=zeros(min([numel(a),numel(b)]),1);ct=0;for i=1:numel(a) for j=1:numel(b) if(a(i)==b(j)) ct=ct+1; c(ct)=a(i); break; end endendc=unique(c)