Mercurial > hg > octave-lyh
diff scripts/general/int2str.m @ 4:b4df021f796c
[project @ 1993-08-08 01:26:08 by jwe]
Initial revision
author | jwe |
---|---|
date | Sun, 08 Aug 1993 01:26:08 +0000 |
parents | |
children | 16a24e76d6e0 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/scripts/general/int2str.m @@ -0,0 +1,19 @@ +function retval = int2str (x) + +# usage: int2str (x) +# +# Round x to the nearest integer and format as a string. +# +# See also: sprintf, num2str + + if (nargin == 1) + if (rows (x) == 1 && columns (x) == 1) + retval = sprintf ("%f\n", round (x)); + else + error ("int2str: expecting scalar argument"); + endif + else + error ("usage: int2str (x)"); + endif + +endfunction