function [xn,yn,idx]=distinctxy(x,y)
% prog to find distinct values of x & y

% first find the non-unique values of x 
  [xs,ids]=sort(x);
  idnux=find(diff(xs)==0)

% remove 1st element from this if possible
%  fe=xs(idnux)-x(1);
%  idfe0=find(fe==0);
%  if idfe0==[];
%    idnux=idnux(2:length(idnux));
%  end;
 
% find non-unique y's
  [ys,idsy]=sort(y(ids));
  idnuy=find(diff(ys)==0);

% remove 1st element from this if possible
%  fe=ys(idnuy)-y(1);
%  idfe0=find(fe==0);
%  if idfe0==[];
%    idnuy=idnuy(2:length(idnuy));
%  end;

  idboth=[];
% now find non-unique elements if idnux and idnux
   for kk=1:length(idnux);
     for yy=1:length(idnuy);
       if idnux(kk)==idnuy(yy);
         idboth=[idboth; idnux(kk)];
       end;
     end;
   end;

  keyboard
  x(ids(idboth))=NaN*ones(length(ids(idboth)),1);



% find the NaN
  idx=find(isnan(x)==0);

  xn = x(idx);
  yn = y(idx);





