From bug-octave-request at bevo dot che dot wisc dot edu Sat Dec 15 15:37:52 2001 Subject: 2.1.33: error in example program for argv in info doc. From: Stephen Eglen To: bug-octave at bevo dot che dot wisc dot edu Cc: stephen at cogsci dot ed dot ac dot uk Date: Sat, 15 Dec 2001 21:37:21 GMT -------- Bug report for Octave 2.1.33 configured for %OCTAVE_CANONICAL_HOST_TYPE% (version of octave bundled with Redhat Linux 7.1) Description: ----------- The info file, under the node "Executable Octave Programs", gives an example program: #! /bin/octave -qf printf ("%s", program_name); for i = 1:nargin printf (" %s", argv(i,:)); endfor printf ("\n"); Repeat-By: --------- Call this program "test.m" and run it with some arguments: % test.m a b c test.merror: lists may only be indexed by a single scalar error: evaluating argument list element number 2 error: evaluating index expression near line 4, column 3 error: evaluating for command near line 3, column 1 A similar program is given in the node "Command Line Options". Fix: --- Change the printf() line within the loop to use "nth": printf (" %s", nth(argv,i)); and then you get: % test.m a b c test.m a b c ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------