Re: Variables and functions. [message #11679] |
Wed, 13 May 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Imanol Echave (ccaeccai@sc.ehu.es) writes:
> I'm executing a program when suddenly... "Variable not defined: SIG". But SIG
> is not a variable, is a function. If I do a HELP, SIG appears as a compiled
> function, but IDL doesn't see it. Anyone knows why?
My guess is that your function is inside a file with other
IDL procedures and functions. But one of these other
procedures and functions refers to this function *before*
the function itself is compiled. In other words, the
procedure that calls the function SIG is compiled *before*
the function SIG.
This causes the reference to SIG to be put into IDL's
"variable list" rather than its "function list". You
can solve the problem by moving the function to a position
in the file ahead of the procedure or function that calls it,
by using the Forward_Function declaration, or by putting
the function in a separate file of its own.
This same behavior can occur if you first refer to
a function incorrectly. For example, if you forget to
use parenthesis in the function call. Here is an example:
IDL> a = Dist
% Variable is undefined: DIST.
% Execution halted at: $MAIN$
Now, IDL thinks DIST is a variable, so is confused even if
I call the function correctly:
IDL> a = Dist(5)
% Variable is undefined: DIST.
% Execution halted at: $MAIN$
I have to explicitly compile the DIST function to make it
active and available to me:
IDL> .Compile Dist
% Compiled module: DIST.
IDL> a = Dist(5)
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Variables and functions. [message #11775 is a reply to message #11679] |
Wed, 13 May 1998 00:00  |
R. Bauer
Messages: 137 Registered: November 1996
|
Senior Member |
|
|
Imanol Echave wrote:
> Hi:
>
> I'm executing a program when suddenly... "Variable not defined: SIG". But SIG
> is not a variable, is a function. If I do a HELP, SIG appears as a compiled
> function, but IDL doesn't see it. Anyone knows why?
this may be a problem of the [ or ( ?
Re
--
R.Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
|
|
|