# HG changeset patch # User jwe # Date 1171354251 0 # Node ID a5cd8b77e892c759801ef52a2931adf6273f55a3 # Parent 2bab2360f07f0f9d1249159e0b55772a4563361a [project @ 2007-02-13 08:08:33 by jwe] diff -r 2bab2360f07f -r a5cd8b77e892 scripts/ChangeLog --- a/scripts/ChangeLog Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/ChangeLog Tue Feb 13 08:10:51 2007 +0000 @@ -1,3 +1,13 @@ +2007-02-13 John W. Eaton + + * plot/__errcomm__.m, plot/__plr1__.m, plot/__plr2__.m, + plot/__plt1__.m, plot/__plt2__.m, plot/__plt2mm__.m, + plot/__plt2mv__.m, plot/__plt2ss__.m, plot/__plt2vm__.m, + plot/__plt2vv__.m, plot/__plt__.m, plot/loglog.m, + plot/loglogerr.m, plot/plot.m, plot/plot3.m, plot/polar.m, + plot/semilogx.m, plot/semilogxerr.m, plot/semilogy.m, + plot/semilogyerr.m: Return handles to line objects. + 2007-02-11 John W. Eaton * plot/__uiobject_close_all.m: New file. @@ -5348,7 +5358,7 @@ bodquist.m lyap.m sysdisc.m buildssic.m mb.m sysdup.m c2d.m minfo.m sysgetsignals.m - com2str.m,v moddemo.m sysgettsam.m + com2str.m moddemo.m sysgettsam.m controldemo.m nichols.m sysgettype.m ctrb.m nyquist.m sysgroup.m d2c.m obsv.m sysgroupn.m diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__errcomm__.m --- a/scripts/plot/__errcomm__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__errcomm__.m Tue Feb 13 08:10:51 2007 +0000 @@ -28,7 +28,7 @@ ## Author: Teemu Ikonen ## Keywords: errorbar, plotting -function __errcomm__ (caller, h, varargin) +function retval = __errcomm__ (caller, h, varargin) if (nargin < 4) print_usage (); @@ -37,6 +37,7 @@ nargs = length (varargin); k = 1; + idx = 1; data = cell(6,1); while (k <= nargs) a = varargin{k++}; @@ -53,7 +54,7 @@ while (k <= nargs) a = varargin{k++}; if (ischar (a) || iscellstr (a)) - __errplot__ (a, h, data{1:ndata}); + retval(idx++) = __errplot__ (a, h, data{1:ndata}); break; elseif (isvector (a)) a = a(:); @@ -73,7 +74,7 @@ endwhile if (! (ischar (a) || iscellstr (a))) - __errplot__ ("~", h, data{1:ndata}); + retval(idx++) = __errplot__ ("~", h, data{1:ndata}); endif drawnow (); diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plr1__.m --- a/scripts/plot/__plr1__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plr1__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plr1__ (h, theta, fmt) +function retval = __plr1__ (h, theta, fmt) if (nargin != 3) print_usage (); @@ -45,6 +45,6 @@ theta = (1:nr)'; endif - __plr2__ (h, theta, rho, fmt); + retval = __plr2__ (h, theta, rho, fmt); endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plr2__.m --- a/scripts/plot/__plr2__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plr2__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plr2__ (h, theta, rho, fmt) +function retval = __plr2__ (h, theta, rho, fmt) if (nargin != 4) print_usage (); @@ -41,7 +41,7 @@ if (isscalar (rho)) x = rho * cos (theta); y = rho * sin (theta); - __plt__ ("polar", h, x, y, fmt); + retval = __plt__ ("polar", h, x, y, fmt); else error ("__plr2__: invalid data for plotting"); endif @@ -58,7 +58,7 @@ endif x = rho .* cos (theta); y = rho .* sin (theta); - __plt__ ("polar", h, x, y, fmt); + retval = __plt__ ("polar", h, x, y, fmt); elseif (ismatrix (rho)) [t_nr, t_nc] = size (theta); if (t_nr == 1) @@ -79,7 +79,7 @@ endif x = diag (cos (theta)) * rho; y = diag (sin (theta)) * rho; - __plt__ ("polar", h, x, y, fmt); + retval = __plt__ ("polar", h, x, y, fmt); else error ("__plr2__: invalid data for plotting") endif @@ -105,14 +105,14 @@ diag_r = diag (rho); x = diag_r * cos (theta); y = diag_r * sin (theta); - __plt__ ("polar", h, x, y, fmt); + retval = __plt__ ("polar", h, x, y, fmt); elseif (ismatrix (rho)) if (! size_equal (rho, theta)) error ("__plr2__: matrix dimensions must match"); endif x = rho .* cos (theta); y = rho .* sin (theta); - __plt__ ("polar", h, x, y, fmt); + retval = __plt__ ("polar", h, x, y, fmt); else error ("__plr2__: invalid data for plotting") endif diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt1__.m --- a/scripts/plot/__plt1__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt1__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt1__ (h, x1, options) +function retval = __plt1__ (h, x1, options) if (nargin < 2 || nargin > 3) print_usage (); @@ -53,6 +53,6 @@ x1 = (1:nr)'; endif - __plt2__ (h, x1, x2, options); + retval = __plt2__ (h, x1, x2, options); endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2__.m --- a/scripts/plot/__plt2__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2__ (h, x1, x2, options) +function retval = __plt2__ (h, x1, x2, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -45,25 +45,26 @@ x2 = real (x2); endif + h_set = false; if (isscalar (x1)) if (isscalar (x2)) - __plt2ss__ (h, x1, x2, options); + retval = __plt2ss__ (h, x1, x2, options); else error ("__plt2__: invalid data for plotting"); endif elseif (isvector (x1)) if (isvector (x2)) - __plt2vv__ (h, x1, x2, options); + retval = __plt2vv__ (h, x1, x2, options); elseif (ismatrix (x2)) - __plt2vm__ (h, x1, x2, options); + retval = __plt2vm__ (h, x1, x2, options); else error ("__plt2__: invalid data for plotting"); endif elseif (ismatrix (x1)) if (isvector (x2)) - __plt2mv__ (h, x1, x2, options); + retval = __plt2mv__ (h, x1, x2, options); elseif (ismatrix (x2)) - __plt2mm__ (h, x1, x2, options); + retval = __plt2mm__ (h, x1, x2, options); else error ("__plt2__: invalid data for plotting"); endif diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2mm__.m --- a/scripts/plot/__plt2mm__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2mm__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2mm__ (h, x, y, options) +function retval = __plt2mm__ (h, x, y, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -42,6 +42,7 @@ if (numel (options) == 1) options = repmat (options(:), x_nc, 1); endif + retval = zeros (x_nc, 1); for i = 1:x_nc tkey = options(i).key; if (! isempty (tkey)) @@ -51,9 +52,9 @@ if (isempty (color)) color = __next_line_color__ (); endif - line (x(:,i), y(:,i), "keylabel", tkey, "color", color, - "linestyle", options(i).linestyle, - "marker", options(i).marker); + retval(i) = line (x(:,i), y(:,i), "keylabel", tkey, "color", color, + "linestyle", options(i).linestyle, + "marker", options(i).marker); endfor else error ("__plt2mm__: arguments must be a matrices"); diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2mv__.m --- a/scripts/plot/__plt2mv__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2mv__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2mv__ (h, x, y, options) +function retval = __plt2mv__ (h, x, y, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -58,6 +58,7 @@ if (numel (options) == 1) options = repmat (options(:), x_nc, 1); endif + retval = zeros (x_nc, 1); for i = 1:x_nc tkey = options(i).key; if (! isempty (tkey)) @@ -67,9 +68,9 @@ if (isempty (color)) color = __next_line_color__ (); endif - line (x(:,i), y, "keylabel", tkey, "color", color, - "linestyle", options(i).linestyle, - "marker", options(i).marker); + retval(i) = line (x(:,i), y, "keylabel", tkey, "color", color, + "linestyle", options(i).linestyle, + "marker", options(i).marker); endfor else error ("__plt2mv__: arguments must be a matrices"); diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2ss__.m --- a/scripts/plot/__plt2ss__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2ss__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2ss__ (h, x, y, options) +function retval = __plt2ss__ (h, x, y, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -49,10 +49,9 @@ if (isempty (color)) color = __next_line_color__ (); endif - line (x, y, "keylabel", key, "color", color, - "linestyle", options.linestyle, - "marker", options.marker); -); + retval = line (x, y, "keylabel", key, "color", color, + "linestyle", options.linestyle, + "marker", options.marker); else error ("__plt2ss__: arguments must be scalars"); endif diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2vm__.m --- a/scripts/plot/__plt2vm__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2vm__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2vm__ (h, x, y, options) +function retval = __plt2vm__ (h, x, y, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -58,6 +58,7 @@ if (numel (options) == 1) options = repmat (options(:), y_nc, 1); endif + retval = zeros (y_nc, 1); for i = 1:y_nc tkey = options(i).key; if (! isempty (tkey)) @@ -67,9 +68,9 @@ if (isempty (color)) color = __next_line_color__ (); endif - line (x, y(:,i), "keylabel", tkey, "color", color, - "linestyle", options(i).linestyle, - "marker", options(i).marker); + retval(i) = line (x, y(:,i), "keylabel", tkey, "color", color, + "linestyle", options(i).linestyle, + "marker", options(i).marker); endfor else error ("__plt2vm__: arguments must be a matrices"); diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt2vv__.m --- a/scripts/plot/__plt2vv__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt2vv__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt2vv__ (h, x, y, options) +function retval = __plt2vv__ (h, x, y, options) if (nargin < 3 || nargin > 4) print_usage (); @@ -63,9 +63,9 @@ if (isempty (color)) color = __next_line_color__ (); endif - line (x, y, "keylabel", key, "color", color, - "linestyle", options.linestyle, - "marker", options.marker); + retval = line (x, y, "keylabel", key, "color", color, + "linestyle", options.linestyle, + "marker", options.marker); else error ("__plt2vv__: vector lengths must match"); endif diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/__plt__.m --- a/scripts/plot/__plt__.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/__plt__.m Tue Feb 13 08:10:51 2007 +0000 @@ -23,7 +23,7 @@ ## Author: jwe -function __plt__ (caller, h, varargin) +function retval = __plt__ (caller, h, varargin) nargs = nargin - 2; @@ -51,9 +51,9 @@ if (x_set) options = __pltopt__ (caller, next_arg); if (y_set) - __plt2__ (h, x, y, options); + retval = __plt2__ (h, x, y, options); else - __plt1__ (h, x, options); + retval = __plt1__ (h, x, options); endif x_set = false; y_set = false; @@ -63,7 +63,7 @@ elseif (x_set) if (y_set) options = __pltopt__ (caller, {""}); - __plt2__ (h, x, y, options); + retval = __plt2__ (h, x, y, options); x = next_arg; y_set = false; else diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/loglog.m --- a/scripts/plot/loglog.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/loglog.m Tue Feb 13 08:10:51 2007 +0000 @@ -28,7 +28,7 @@ ## Author: jwe -function loglog (varargin) +function retval = loglog (varargin) newplot (); @@ -37,6 +37,10 @@ set (h, "xscale", "log", "yscale", "log"); - __plt__ ("loglog", h, varargin{:}); + tmp = __plt__ ("loglog", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/loglogerr.m --- a/scripts/plot/loglogerr.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/loglogerr.m Tue Feb 13 08:10:51 2007 +0000 @@ -40,7 +40,7 @@ ## Author: Teemu Ikonen ## Keywords: errorbar, plotting -function loglogerr (varargin) +function retval = loglogerr (varargin) newplot (); @@ -49,6 +49,10 @@ set (h, "xscale", "log", "yscale", "log"); - __errcomm__ ("loglogerr", h, varargin{:}); + tmp = __errcomm__ ("loglogerr", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/plot.m --- a/scripts/plot/plot.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/plot.m Tue Feb 13 08:10:51 2007 +0000 @@ -171,10 +171,14 @@ ## Author: jwe -function plot (varargin) +function retval = plot (varargin) newplot (); - __plt__ ("plot", gca (), varargin{:}); + tmp = __plt__ ("plot", gca (), varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/plot3.m --- a/scripts/plot/plot3.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/plot3.m Tue Feb 13 08:10:51 2007 +0000 @@ -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 diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/polar.m --- a/scripts/plot/polar.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/polar.m Tue Feb 13 08:10:51 2007 +0000 @@ -29,7 +29,7 @@ ## Author: jwe -function polar (varargin) +function retval = polar (varargin) newplot (); @@ -42,19 +42,23 @@ if (! ischar (varargin{3})) error ("polar: third argument must be a string"); endif - __plr2__ (h, varargin{:}); + tmp = __plr2__ (h, varargin{:}); elseif (nargin == 2) if (ischar (varargin{2})) - __plr1__ (h, varargin{:}); + tmp = __plr1__ (h, varargin{:}); else fmt = ""; - __plr2__ (h, varargin{:}, fmt); + tmp = __plr2__ (h, varargin{:}, fmt); endif elseif (nargin == 1) fmt = ""; - __plr1__ (h, varargin{:}, fmt); + tmp = __plr1__ (h, varargin{:}, fmt); else print_usage (); endif + if (nargout > 0) + retval = tmp; + endif + endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/semilogx.m --- a/scripts/plot/semilogx.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/semilogx.m Tue Feb 13 08:10:51 2007 +0000 @@ -28,7 +28,7 @@ ## Author: jwe -function semilogx (varargin) +function retval = semilogx (varargin) newplot (); @@ -37,6 +37,10 @@ set (h, "xscale", "log"); - __plt__ ("semilogx", h, varargin{:}); + tmp = __plt__ ("semilogx", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/semilogxerr.m --- a/scripts/plot/semilogxerr.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/semilogxerr.m Tue Feb 13 08:10:51 2007 +0000 @@ -40,7 +40,7 @@ ## Author: Teemu Ikonen ## Keywords: errorbar, plotting -function semilogxerr (varargin) +function retval = semilogxerr (varargin) newplot (); @@ -49,6 +49,10 @@ set (h, "xscale", "log"); - __errcomm__ ("semilogxerr", h, varargin{:}); + tmp = __errcomm__ ("semilogxerr", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/semilogy.m --- a/scripts/plot/semilogy.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/semilogy.m Tue Feb 13 08:10:51 2007 +0000 @@ -28,7 +28,7 @@ ## Author: jwe -function semilogy (varargin) +function retval = semilogy (varargin) newplot (); @@ -37,6 +37,10 @@ set (h, "yscale", "log"); - __plt__ ("semilogy", h, varargin{:}); + tmp = __plt__ ("semilogy", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction diff -r 2bab2360f07f -r a5cd8b77e892 scripts/plot/semilogyerr.m --- a/scripts/plot/semilogyerr.m Sun Feb 11 19:46:53 2007 +0000 +++ b/scripts/plot/semilogyerr.m Tue Feb 13 08:10:51 2007 +0000 @@ -40,7 +40,7 @@ ## Author: Teemu Ikonen ## Keywords: errorbar, plotting -function semilogyerr (varargin) +function retval = semilogyerr (varargin) newplot (); @@ -49,6 +49,10 @@ set (h, "yscale", "log"); - __errcomm__ ("semilogyerr", h, varargin{:}); + tmp = __errcomm__ ("semilogyerr", h, varargin{:}); + + if (nargout > 0) + retval = tmp; + endif endfunction