annotate general/funutils/scanner_add_plotter.m @ 26:8f4a21082c45

It was wrong. Now it is right.
author samer
date Sat, 19 Jan 2013 13:09:31 +0000
parents fbc0540a9208
children beb8a3f4a345
rev   line source
samer@12 1 % scanner_add_plotter - Add plotting capabilities to scan function
samer@12 2 %
samer@12 3 % scanner_add_plotter ::
samer@12 4 % (S,X->S) ~'scanning function',
samer@12 5 % options {
samer@12 6 % draw :: bool/false ~'enable drawing if true';
samer@12 7 % pause :: natural/0 ~'pause duration in ms';
samer@12 8 % drawnow :: bool/true ~'whether or not to call drawnow afterwards'
samer@12 9 % }
samer@12 10 % -> (S,X->X) ~'new scanning function'.
samer@12 11
samer@12 12 function f1=scanner_add_plotter(f,opts)
samer@12 13 opts=prefs('draw',0,varargin{:});
samer@12 14 if ~opts.draw, f1=f; else ps=pauser(opts); f1=@g; end
samer@26 15 function y1=g(y,x), y1=f(y,x); opts.plotfn(x,y,y1); ps(); end
samer@12 16 end