samer@0
|
1 function u=construct(s,sizes_in)
|
samer@0
|
2 figure(fig(s)); cla; set(gcf,'Name',name(s));
|
samer@0
|
3 h=s.opts.scatfn(zeros(sizes_in{1}),s.opts.args{:});
|
samer@0
|
4 if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end
|
samer@0
|
5 if ~isempty(s.opts.ylim), ylim(s.opts.ylim); end
|
samer@0
|
6 if ~isempty(s.opts.zlim), zlim(s.opts.zlim); end
|
samer@0
|
7 if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end
|
samer@0
|
8 if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end
|
samer@0
|
9 if isfield(s.opts,'zlabel'), xlabel(s.opts.zlabel); end
|
samer@0
|
10 if isfield(s.opts,'rotate3d'), rotate3d(s.opts.rotate3d); end
|
samer@0
|
11
|
samer@0
|
12
|
samer@0
|
13 u=mkunit(s);
|
samer@0
|
14 af=autoflush(s);
|
samer@0
|
15 if sizes_in{1}(2)<=2 u.process =@proc_2d;
|
samer@0
|
16 else u.process =@proc_3d;
|
samer@0
|
17 end
|
samer@0
|
18
|
samer@0
|
19 u.sizes_out = {};
|
samer@0
|
20 u.dispose = @()delete(h);
|
samer@0
|
21
|
samer@0
|
22 function proc_2d(x)
|
samer@0
|
23 set(h,'XData',x(:,1),'YData',x(:,2));
|
samer@0
|
24 if (af), drawnow; end
|
samer@0
|
25 end
|
samer@0
|
26 function proc_3d(x)
|
samer@0
|
27 set(h,'XData',x(:,1),'YData',x(:,2),'ZData',x(:,3));
|
samer@0
|
28 if (af), drawnow; end
|
samer@0
|
29 end
|
samer@0
|
30 end
|