Mercurial > hg > ishara
view general/algo/pauser.m @ 37:beb8a3f4a345
Renamed prefs to options throughout.
author | samer |
---|---|
date | Mon, 28 Jan 2013 10:52:11 +0000 |
parents | e44f49929e56 |
children |
line wrap: on
line source
function f=pauser(varargin) % pauser - Return function to pause or not depending on options % % pauser :: options { % pause :: natural/0 ~'0 for no pause, 1 pause, >10 for ms pause'; % drawnow :: {0,1}/1 ~'call drawnow to flush graphics' % } -> (void => void) ~'function to pause or not'. % % pauser(opts) returns a function that does exactly what optpause(opts) % does. opt=options(varargin{:}); ps=getparam(opt,'pause',0); dn=getparam(opt,'drawnow',1); if ps, if ps<10, f=@pause; else wait=ps/1000; f=@()pause(wait); end elseif dn, f=@drawnow; else f=@nop; end