Mercurial > hg > octave-nkf
annotate 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 |
rev | line source |
---|---|
4 | 1 function retval = int2str (x) |
2 | |
3 # usage: int2str (x) | |
4 # | |
5 # Round x to the nearest integer and format as a string. | |
6 # | |
7 # See also: sprintf, num2str | |
8 | |
9 if (nargin == 1) | |
10 if (rows (x) == 1 && columns (x) == 1) | |
11 retval = sprintf ("%f\n", round (x)); | |
12 else | |
13 error ("int2str: expecting scalar argument"); | |
14 endif | |
15 else | |
16 error ("usage: int2str (x)"); | |
17 endif | |
18 | |
19 endfunction |