help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sample code in the manual is giving errors


From: John W. Eaton
Subject: sample code in the manual is giving errors
Date: Tue, 10 Apr 2007 15:05:34 -0400

On 10-Apr-2007, Kamaraju S Kusumanchi wrote:

| Using Debian Etch, Octave 2.9.9.
| Octave manual (Edition 3 for Octave version 2.9.9, February 1997)
| located at /usr/share/doc/octave2.9-doc/octave.pdf
| 
| On pg-26 (section 2.6) of this manual the sample code to reproduce the
| command is not working
| 
| $ls -al reproduce.m
| -rwxr-xr-x 1 rajulocal rajulocal 112 2007-04-10 13:00 reproduce.m
| 
| $cat reproduce.m
| #! /usr/bin/octave -qf
| printf("%s", program_name);
| for i=1:nargin
|         printf(" %s", argv{i});
| endfor
| printf("\n");
| 
| 
| $./reproduce.m -something
| reproduce.merror: built-in function cannot be indexed with {
| error: evaluating argument list element number 2
| error: evaluating for command near line 3, column 1
| error: near line 5 of file `./reproduce.m'
| 
| 
| I believe, it should be
| 
|         printf(" %s", nth(argv, i));
| 
| instead of
| 
|         printf(" %s", argv{i});
| 
| But I am not sure.

No, in the current sources, it says:

  Here is an example of using these functions to reproduce Octave's
  command line.

  @example
  printf ("%s", program_name ());
  for i = 1:nargin
    arg_list = argv ();
    printf (" %s", address@hidden@});
  endfor
  printf ("\n");
  @end example

Please report bugs to the address@hidden list.

Also, please consider using an email address for the list that does
not require users to go to some web page and do something to be able
to send you mail.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]