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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/general/int2str.m	Sun Aug 08 01:26:08 1993 +0000
@@ -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