help-octave
[Top][All Lists]
Advanced

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

[no subject]


From: John W. Eaton
Date: Wed, 02 Apr 2008 21:53:59 -0400

On  2-Apr-2008, Peter Williams wrote:

| error: can't perform indexing operations for <unknown type> type
| 
| I get this error during a shooting algorithm as part of a simulation when 
| variables are returned from a function.  As a test I wrote the simplest 
| possible function call:
| 
| clear all
| A=2;
| d = others(A)
| 
| %%%%%%%%%%%%%%
| 
| function d = others(A)
| d=A^2;
| return
| 
| and still get the error message! 
| The program returns a value consistent with the function, so variables are 
| being passed, but then octave prints out the error message when I quit the 
| program.  Am I doing something idiotic? 

I'm having trouble understanding precisely when the message occurs.
What do you mean "when I quit the program"?  Do you mean when you exit
Octave?  How are you exiting Octave?

What version of Octave are you using?

One way this message can happen is if you try to perform an indexing
operation on a function that is really a script (i.e., a .m file that
does not begin with the "function" keyword).  For example, if you have
a file called foo.m that contains the line:

  1; # this is not a function

and call it any any of the following ways:

  foo(1)
  foo{1}
  foo.a

then Octave will display the error message you show above.  This
happens because scripts (and functions) in Octave can be called with
no arguments (and without needing "()" to indicate an empty argument
list), so Octave is executing the script "foo" and then attempting to
index the result.  But since there isn't a result, it fails.

Does that help you diagnose the problem?

jwe


reply via email to

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