Mercurial > hg > octave-kai
changeset 8684:6d15bc6c4c15
polyout.m: Replace com2str with num2str.
author | Thomas D. Dean <tomdean@speakeasy.org> |
---|---|
date | Thu, 05 Feb 2009 13:42:29 -0500 |
parents | e4f89f4a7cf8 |
children | 983ac67dc3d4 |
files | scripts/ChangeLog scripts/polynomial/polyout.m |
diffstat | 2 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-02-05 Thomas D. Dean <tomdean@speakeasy.org> + + * polynomial/polyout.m: Replace com2str with num2str, and minor + style changes. + 2009-02-04 John W. Eaton <jwe@octave.org> * help/which.m: Still print something sensible if type is empty.
--- a/scripts/polynomial/polyout.m +++ b/scripts/polynomial/polyout.m @@ -53,15 +53,14 @@ if (nargin == 1) x = "s"; - elseif (! ischar(x)) + elseif (! ischar (x)) error("polyout: second argument must be a string"); endif - n = length(c); + n = length (c); if(n > 0) n1 = n+1; - tmp = coeff (c(1)); for ii = 2:n if (real (c(ii)) < 0) @@ -79,21 +78,21 @@ endif if(nargout == 0) - disp(tmp) + disp (tmp) else y = tmp; endif endfunction -function str = coeff(c) +function str = coeff (c) if (imag (c)) if (real (c)) - str = sprintf ("(%s)", com2str(c)); + str = sprintf ("(%s)", num2str (c, 5)); else - str = com2str(c); + str = num2str (c, 5); endif else - str = num2str(c); + str = num2str (c, 5); endif - +endfunction