annotate 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 |
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@12
|
15 function y1=g(y,x), y1={f(y,x),i}; opts.plotfn(x,y,y1); ps(); end
|
samer@12
|
16 end
|