diff scripts/testfun/demo.m @ 12505:6a1fe83fe129

Allow command forms of example and demo.
author Ben Abbott <bpabbott@mac.com>
date Sat, 26 Feb 2011 18:15:48 -0500
parents c792872f8942
children 55430618bd5f
line wrap: on
line diff
--- a/scripts/testfun/demo.m
+++ b/scripts/testfun/demo.m
@@ -17,7 +17,8 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} demo ('@var{name}', @var{n})
+## @deftypefn  {Command} {} demo @var{name} @var{n}
+## @deftypefnx {Function File} {} demo ('@var{name}', @var{n})
 ##
 ## Runs any examples associated with the function '@var{name}'.
 ## Examples are stored in the script file, or in a file with the same
@@ -87,7 +88,9 @@
 
   if (nargin < 2)
     n = 0;
-  endif
+  elseif (strcmp ("char", class (n)))
+    n = str2double (n);
+  endif 
 
   [code, idx] = test (name, "grabdemo");
   if (length (idx) == 0)