annotate general/funutils/scanner_add_plotter.m @ 40:62304c930111
Reversed order of * function composition to match arrow * combinator.
author |
samer |
date |
Tue, 29 Jan 2013 17:04:40 +0000 |
parents |
beb8a3f4a345 |
children |
|
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@37
|
13 opts=options('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
|