help-octave
[Top][All Lists]
Advanced

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

Re:


From: Peter Williams
Subject: Re:
Date: Thu, 3 Apr 2008 08:46:47 -0700
User-agent: KMail/1.9.7

I'm laughing - running it without the .m appended fixed it.  thanks you guys.

Peter

On Wednesday 02 April 2008 06:53:59 pm John W. Eaton wrote:
> 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)
> |
> | %%%%%%%%%%%%%%This starts a new file  (others.m)
> |
> | 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



-- 
Peter Tucker Williams
Graduate Teaching Fellow
Department of Economics
University of Oregon


reply via email to

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