view general/funutils/scanner_add_plotter.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents beb8a3f4a345
children
line wrap: on
line source
% scanner_add_plotter - Add plotting capabilities to scan function
%
% scanner_add_plotter ::
%    (S,X->S) ~'scanning function',
%    options {
%       draw    :: bool/false ~'enable drawing if true';
%       pause   :: natural/0 ~'pause duration in ms';
%       drawnow :: bool/true ~'whether or not to call drawnow afterwards'
%    }
% -> (S,X->X) ~'new scanning function'.

function f1=scanner_add_plotter(f,opts)
	opts=options('draw',0,varargin{:});
	if ~opts.draw, f1=f; else ps=pauser(opts); f1=@g; end
	function y1=g(y,x), y1=f(y,x); opts.plotfn(x,y,y1); ps(); end
end