help-octave
[Top][All Lists]
Advanced

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

Re: Help on error: can't perform indexing


From: John W. Eaton
Subject: Re: Help on error: can't perform indexing
Date: Thu, 15 Feb 2007 00:14:28 -0500

On 14-Feb-2007, Muthiah Annamalai wrote:

| On Wed, 2007-02-14 at 11:42 -0800, Maynard Wright wrote:
| > , the Octave script file runs correctly and yields the right answer 
| > and the message is then displayed.  This occurs only when a script
| > file with 
| > an extension ".m" is executed from within Octave.
| O.K Can you please post what script you got, and what version of Octave
| you are running? Maybe you should post a bug-report on the address@hidden
| list if possible.
| 
| >   When there is no extension 
| > or when the extension is other than ".m," the file cannot be executed
| > without 
| > using source "filename."  When source is used to execute the file, I
| > don't 
| > see the error message, even when the filename has a ".m" extension. 
| > 
| That is correct behavior. See 'help source'
| 
| 
| > When the ".m" file is executed as a script from the Linux command
| > line, it 
| > works properly and the error message does not occur.
| > 
| > I used addpath() to add the path containing the file without effect.
| > The path 
| > was already in my bash shell PATH va 
| I cant say anything. You need to be more specific, please.

I think you already diagnosed the problem in an earlier message:

  OTOH, Octave tries to decode prog.m as a structure prog, with field m
  which is why it reports such an error I believe.

Maybe the following will help.

To execute a function or script, you use the name of the function or
script file without the ".m" extension.  To call a function, you don't
need to write "foo ()" (though I generally prefer this syntax).  A
simple "foo" will work if the function takes no arguments.  So if you
write

  prog.m

then Octave calls the function "prog", then attempts to perform
structure indexing (the .m part of the expression) on the value
returned from "prog".  If the function doesn't return a value, then
the structure indexing fails with the message:

  error: can't perform indexing operations for <unknown type> type 

This is not a bug in Octave.

jwe


reply via email to

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