Mercurial > hg > octave-lyh
diff scripts/polynomial/polyout.m @ 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 | 81d6ab3ac93c |
children | 983ac67dc3d4 |
line wrap: on
line diff
--- 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