whatsmissing.m (378B)
1 % whatsmissing.m 2 % 3 % m=whatsmissing(x,y) 4 % 5 % Compare two vectors x and y and return the elements that are not 6 % present in both. 7 8 function m=whatsmissing(x,y); 9 10 m=[]; 11 % first loop through x 12 for i=1:length(x); 13 j=any(find(y==x(i))); 14 if ~j; m=[m; x(i)]; end; 15 end; 16 17 % now loop through y 18 for i=1:length(y); 19 j=any(find(x==y(i))); 20 if ~j; m=[m; y(i)]; end; 21 end;