Mercurial > hg > ishara
annotate general/algo/pauser.m @ 28:673b8e45d05a
Tidied up indentation.
author | samer |
---|---|
date | Sat, 19 Jan 2013 14:40:54 +0000 |
parents | e44f49929e56 |
children | beb8a3f4a345 |
rev | line source |
---|---|
samer@4 | 1 function f=pauser(varargin) |
samer@4 | 2 % pauser - Return function to pause or not depending on options |
samer@4 | 3 % |
samer@4 | 4 % pauser :: options { |
samer@4 | 5 % pause :: natural/0 ~'0 for no pause, 1 pause, >10 for ms pause'; |
samer@4 | 6 % drawnow :: {0,1}/1 ~'call drawnow to flush graphics' |
samer@4 | 7 % } -> (void => void) ~'function to pause or not'. |
samer@4 | 8 % |
samer@4 | 9 % pauser(opts) returns a function that does exactly what optpause(opts) |
samer@4 | 10 % does. |
samer@4 | 11 |
samer@4 | 12 opt=prefs(varargin{:}); |
samer@4 | 13 ps=getparam(opt,'pause',0); |
samer@4 | 14 dn=getparam(opt,'drawnow',1); |
samer@4 | 15 if ps, |
samer@4 | 16 if ps<10, f=@pause; |
samer@4 | 17 else wait=ps/1000; f=@()pause(wait); |
samer@4 | 18 end |
samer@4 | 19 elseif dn, f=@drawnow; |
samer@4 | 20 else f=@nop; |
samer@4 | 21 end |