diff scripts/plot/plot3.m @ 6302:a5cd8b77e892

[project @ 2007-02-13 08:08:33 by jwe]
author jwe
date Tue, 13 Feb 2007 08:10:51 +0000
parents 0078497b3b0b
children 2110cc251779
line wrap: on
line diff
--- a/scripts/plot/plot3.m
+++ b/scripts/plot/plot3.m
@@ -93,12 +93,14 @@
 ## Author: Paul Kienzle
 ##         (modified from __plt__.m)
 
-function plot3 (varargin)
+function retval = plot3 (varargin)
 
   x_set = 0;
   y_set = 0;
   z_set = 0;
 
+  idx = 0;
+
   ## Gather arguments, decode format, and plot lines.
   for arg = 1:nargin
     new = varargin{arg};
@@ -148,10 +150,10 @@
 	set (gca (), "key", "on");
       endif
 
-      line (x(:), y(:), z(:), "keylabel", key,
-	    "color", options.color,
-	    "linestyle", options.linestyle,
-	    "marker", options.marker);
+      tmp(++idx) = line (x(:), y(:), z(:), "keylabel", key,
+			 "color", options.color,
+			 "linestyle", options.linestyle,
+			 "marker", options.marker);
 
       x_set = 0;
       y_set = 0;
@@ -182,7 +184,7 @@
 	error ("plot3: x, y, and z must have the same shape");
       endif
 
-      line (x(:), y(:), z(:));
+      tmp(++idx) = line (x(:), y(:), z(:));
 
       x = new;
       y_set = 0;
@@ -228,10 +230,14 @@
       error ("plot3: x, y, and z must have the same shape");
     endif
 
-    line (x(:), y(:), z(:));
+    tmp(++idx) = line (x(:), y(:), z(:));
 
   endif
 
   set (gca (), "view", [-37.5, 30]);
 
+  if (nargout > 0 && idx > 0)
+    retval = tmp;
+  endif
+
 endfunction