function n = mark(x,y,res)
%function n = mark(x,y,res)
n=[];
%plot(x,y,'x');
hold on
if nargin==2
       res=20;     % 20 divs across screen
end
xrange = (max(x(:))-min(x(:)))/20;
yrange = (max(y(:))-min(y(:)))/20;

while 1==1

[x1,y1,ibutton] = ginput(1);
plot(x1,y1,'.')

if ((ibutton==27)|(ibutton==2)), break, end
i = find((abs(x1-x)<xrange)&(abs(y1-y)<yrange));
if length(i)>1
     xx=((x1-x(i))/xrange).^2+((y1-y(i))/yrange).^2;
     [xx,ii]=sort(xx);
     i=i(ii(1));
end;
if length(i)>0
      plot(x(i),y(i),'oc5')
	      n=[n i];
end

end

