samer@0
|
1 function u=construct(s,sizes_in)
|
samer@0
|
2 acquire(s);
|
samer@0
|
3 eff_size=sizes_in{1};
|
samer@0
|
4 if s.opts.transpose, eff_size = eff_size([2,1]); end
|
samer@0
|
5 if isempty(s.opts.dom), dom=1:eff_size(1); else dom=s.opts.dom; end
|
samer@0
|
6 figure(fig(s)); set(gcf,'Name',name(s));
|
samer@0
|
7
|
samer@0
|
8 if s.opts.transpose, pre=@transpose; else pre=@id; end
|
samer@0
|
9 if isempty(dom)
|
samer@0
|
10 h=s.opts.plotfn(pre(zeros(sizes_in{1})),s.opts.args{:});
|
samer@0
|
11 else
|
samer@0
|
12 h=s.opts.plotfn(dom,pre(zeros(sizes_in{1})),s.opts.args{:});
|
samer@0
|
13 end
|
samer@0
|
14
|
samer@0
|
15 if isempty(s.opts.xlim) && numel(dom)>1, s.opts.xlim=[dom(1),dom(end)]; end
|
samer@0
|
16 if ~isempty(s.opts.ylim), ylim(s.opts.ylim); end
|
samer@0
|
17 if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end
|
samer@0
|
18 if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end
|
samer@0
|
19 if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end
|
samer@0
|
20
|
samer@0
|
21 u=mkunit(s);
|
samer@0
|
22 if length(h)==1
|
samer@0
|
23 if autoflush(s), u.process =@proc_flush;
|
samer@0
|
24 else u.process=@proc_noflush; end
|
samer@0
|
25 else
|
samer@0
|
26 af=autoflush(s);
|
samer@0
|
27 u.process =@proc_mat;
|
samer@0
|
28 end
|
samer@0
|
29
|
samer@0
|
30 u.sizes_out = {};
|
samer@0
|
31 u.dispose = @dispose;
|
samer@0
|
32
|
samer@0
|
33 function dispose, delete(h); release(s); end
|
samer@0
|
34 function proc_flush(x), set(h,'YData',pre(x)); drawnow; end
|
samer@0
|
35 function proc_noflush(x), set(h,'YData',pre(x)); end
|
samer@0
|
36 function proc_mat(x),
|
samer@0
|
37 if s.opts.transpose
|
samer@0
|
38 for i=1:length(h)
|
samer@0
|
39 set(h(i),'YData',x(i,:)');
|
samer@0
|
40 end
|
samer@0
|
41 else
|
samer@0
|
42 for i=1:length(h)
|
samer@0
|
43 set(h(i),'YData',x(:,i));
|
samer@0
|
44 end
|
samer@0
|
45 end
|
samer@0
|
46 if af, drawnow; end
|
samer@0
|
47 end
|
samer@0
|
48 end
|