diff scripts/general/num2str.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/num2str.m
@@ -0,0 +1,19 @@
+function retval = num2str (x)
+
+# usage: num2str (x)
+#
+# Format x as a string.
+#
+# See also: sprintf, int2str
+
+  if (nargin == 1)
+    if (rows (x) == 1 && columns (x) == 1)
+      retval = sprintf ("%g", x);
+    else
+      error ("num2str: expecting scalar argument");
+    endif
+  else
+    error ("usage: num2str (x)");
+  endif
+
+endfunction