diff arrows/@scatterer/construct.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arrows/@scatterer/construct.m	Wed Dec 19 22:38:28 2012 +0000
@@ -0,0 +1,30 @@
+function u=construct(s,sizes_in)
+	figure(fig(s)); cla; set(gcf,'Name',name(s));
+	h=s.opts.scatfn(zeros(sizes_in{1}),s.opts.args{:});
+	if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end
+	if ~isempty(s.opts.ylim), ylim(s.opts.ylim); end
+	if ~isempty(s.opts.zlim), zlim(s.opts.zlim); end
+	if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end
+	if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end
+	if isfield(s.opts,'zlabel'), xlabel(s.opts.zlabel); end
+	if isfield(s.opts,'rotate3d'), rotate3d(s.opts.rotate3d); end
+	
+
+	u=mkunit(s);
+	af=autoflush(s);
+	if sizes_in{1}(2)<=2 u.process =@proc_2d;
+	else u.process =@proc_3d;
+	end
+
+	u.sizes_out = {};
+	u.dispose = @()delete(h);
+
+	function proc_2d(x)
+		set(h,'XData',x(:,1),'YData',x(:,2)); 
+		if (af), drawnow; end 
+	end
+	function proc_3d(x)
+		set(h,'XData',x(:,1),'YData',x(:,2),'ZData',x(:,3)); 
+		if (af), drawnow; end 
+	end
+end