view general/algo/optpause.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 03694e5c8365
children
line wrap: on
line source
function optpause(opt)
% optpause - Optionally pause and/or update graphics
%
% optpause :: struct {
%    pause   :: nonneg/0 ~'0-nopause, 1-pause, N-timed pause in ms';
%    drawnow :: bool/0  ~'flush graphics if not pausing'
% } => void.

ps=getparam(opt,'pause',0);
dn=getparam(opt,'drawnow',1);
if ps, 
	if ps>=10, pause(ps/1000); else pause; end 
elseif dn, drawnow;
end