holdstatus=ishold; hold on button=1; % initialize to left button disp('press left button to select pts; right button to exit selections') while button==1 [x,y,button]=ginput(1) plot(x,y,'+') end if holdstatus hold on else%if hold off end%if