Mercurial > hg > octave-lyh
diff scripts/plot/__plt2mv__.m @ 6146:1a6d826e92b5
[project @ 2006-11-09 03:13:11 by jwe]
author | jwe |
---|---|
date | Thu, 09 Nov 2006 03:15:23 +0000 |
parents | 34f96dd5441b |
children | 44c91c5dfe1d |
line wrap: on
line diff
--- a/scripts/plot/__plt2mv__.m +++ b/scripts/plot/__plt2mv__.m @@ -23,12 +23,18 @@ ## Author: jwe -function [data, fmtstr] = __plt2mv__ (x, y, fmt) +function [data, fmtstr, key] = __plt2mv__ (x, y, fmt, keystr) + + if (nargin < 2 || nargin > 4 || nargout < 2 || nargou > 3) + print_usage (); + endif - if (nargin < 2 || nargin > 3 || nargout != 2) - print_usage (); - elseif (nargin == 2 || isempty (fmt)) - fmt = " "; ## Yes, this is intentionally not an empty string! + if (nargin < 3 || isempty (fmt)) + fmt = {""}; + endif + + if (nargin < 3 || isempty (keystr)) + keystr = {""}; endif [x_nr, x_nc] = size (x); @@ -56,15 +62,21 @@ if (rows (fmt) == 1) fmt = repmat (fmt, x_nc, 1); endif + if (rows (keystr) == 1) + keystr = repmat (keystr, x_nc, 1); + endif tmp = [x, y]; dtmp = cell (x_nc, 1); ftmp = cell (x_nc, 1); + ktmp = cell (x_nc, 1); for i = 1:x_nc dtmp{i} = tmp(:,[i,x_nc+1]); - ftmp{i} = deblank (fmt(i,:)); + ftmp{i} = deblank (fmt{i}); + ktmp{i} = deblank (keystr{i}); endfor data = dtmp; fmtstr = ftmp; + key = ktmp; else error ("__plt2mv__: arguments must be a matrices"); endif