[Top][All Lists]

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

sample code in the manual is giving errors

From: Kamaraju S Kusumanchi
Subject: sample code in the manual is giving errors
Date: Tue, 10 Apr 2007 13:57:59 -0400
User-agent: KNode/0.10.4

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});

$./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.

$bash --version
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.


Kamaraju S Kusumanchi

reply via email to

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