comparison general/funutils/scanner_add_plotter.m @ 12:fbc0540a9208

Moved some high-order functions from funutils to arrutils, updated docs and cleaned up funutils.
author samer
date Mon, 14 Jan 2013 22:21:11 +0000
parents
children 8f4a21082c45
comparison
equal deleted inserted replaced
11:8eec969fd4d3 12:fbc0540a9208
1 % scanner_add_plotter - Add plotting capabilities to scan function
2 %
3 % scanner_add_plotter ::
4 % (S,X->S) ~'scanning function',
5 % options {
6 % draw :: bool/false ~'enable drawing if true';
7 % pause :: natural/0 ~'pause duration in ms';
8 % drawnow :: bool/true ~'whether or not to call drawnow afterwards'
9 % }
10 % -> (S,X->X) ~'new scanning function'.
11
12 function f1=scanner_add_plotter(f,opts)
13 opts=prefs('draw',0,varargin{:});
14 if ~opts.draw, f1=f; else ps=pauser(opts); f1=@g; end
15 function y1=g(y,x), y1={f(y,x),i}; opts.plotfn(x,y,y1); ps(); end
16 end