Re: Keyword discrimination [message #12522 is a reply to message #12518] |
Wed, 12 August 1998 00:00  |
Vap User
Messages: 31 Registered: April 1998
|
Member |
|
|
Imanol Echave <ccaeccai@sc.ehu.es> writes:
I take it that you are trying to determine whether a keyword is set in
order to know whether to calculate an output variable.
There is no way to discriminate these two cases for versions < 5.1
that I am aware of. However, in IDL 5.1 there is the function
ARG_PRESENT() which will tell you that a keyword or positional
argument is present and is a named variable into which a value may be
passed.
If you are working with a version < 5.1 and the data intended for
output is small, there isn't much penalty in creating it whether the
return variable is there or not. Otherwise, you might need a two
variable scheme, one, a flag to tell the routine to calculate the
output, and the other the actual output area.
Best bet, get IDL 5.1 and use arg_present.
FYI: keyword_set(arg) = 0 if arg is undefined, or arg is not present
in call, or arg=0,
> Hi people:
>
> he question is: How to discriminate between a keyword not set and a
> keyword set to an undefined variable? N_ELEMENTS returns 0 in the
> two cases.
--
I don't speak for JPL, it doesn't speak for me.
Well, not all the time, at least.
William Daffer <vapuser@haifung.jpl.nasa.gov>
|
|
|