fushg %show graph clf %clear plotting window n=1; %index x=0; set (gcf,'doublebuffer','on') y=1; h=plot(n,y,'.'); axis([-1 1 -1 1]) axis square stop=uicontrol('style','toggle','string','stop'); while get(stop,'value')==0 y=cos(n/200); set(h,'xdata',x,'ydata',y); drawnow; n=n+1; end