help-octave
[Top][All Lists]
Advanced

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

Re: Scripting error message


From: John W. Eaton
Subject: Re: Scripting error message
Date: Fri, 3 Dec 2004 12:14:49 -0500

On 26-Nov-2004, David Bateman <address@hidden> wrote:

| According to NZG <address@hidden> (on 11/26/04):
| > Every time I run a script it in Octave I get the message:
| > 
| > source(Problem72.m)
| > error: can't perform indexing operations for <unknown type> type
| > error: evaluating argument list element number 1
| > 
| > My script looks like this
| > #Problem 7.2
| > 1;
| > 
| > A = [1 1;1 1];
| > B = [0;1];
| > C = [1 0];
| > 
| > m = 1;
| > alpha = 10;
| > beta = 10;
| > 
| > It works just fine, but always generates the error message.
| > Is my syntax wrong?
| > What am I forgetting?
| 
| I don't think your code worked at all.... The problem is that octave 
| thinks that Problem72.m is the element "m" of the structure "Problem72".
| As the variable Problem72 doesn't exist, octave doesn't know its type.

But it sort of works, because Octave parses an expression like

  source(Problem72.m)

as

  NAME ( NAME . STRUCT_ELT )

which reduces to an identifier indexed by the result of a structure
element reference.  So the first thing to do is evaluate the argument
of the index expression (thei structure element reference).  To do
that, it evaluates the left-most part of the expression.  In this
case it the identifier, "Problem72", which it finds as a script, so it
executes that (which is why the overall command it appears to work in
spite of the error).  The evaluation of the script does not produce a
value, so the structure element (the ".m" part) fails.

jwe



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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