% simple script to control pause and notify in the command window % pause for pauseit seconds % pauseit = NaN or Inf pauses until keystroke try switch pauseit case 0 case 1 disp('Paused ... press key to continue ...') pause disp('...continuing') otherwise disp('Pausing...') pause(pauseit) disp('...continuing') end catch warning('Attempt to use pause_it function but flag pauseit=[]') disp(' therefore setting pause off with pauseit = 0') pauseit = 0; end % but always force plotting of the current frame drawnow