Re: SOLVED Re: puzzled with WHERE [message #21639] |
Thu, 07 September 2000 05:43 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Henk (deckard_007@deja.com) writes:
> Sorry, stupid. one-dimensional array is not the same as a simple float
> value.
> Can't IDL solve this ?
Probably, but I think the request falls into the
"having your cake and eating it too" category. Clearly
someone made the decision (I'd bet at a user request)
to have the WHERE function do different things based
on whether the array in question is being compared
to a scalar or to an array. (This is well documented
in the on-line help.)
Changing the rule arbitrarily for a little array
would surely bring down the ire of all those people
who have come to depend on this behavior. If it were
me, I'd put this request into the "forget it" pile. :-)
Cheers,
David
P.S. Since there is real danger of carpel tunnel
syndrome for those of us foolish enough to sit
in front of a computer all day instead of getting
a real job, allow me to point out, Henk, that
you are doing a LOT of unnecessary typing:
xlist = fltarr(1000)
xlist = findgen(1000)
The first statement may have been required in
FORTRAN or PASCAL back when you and I were
in school (it is so long ago I can barely
remember), but it is totally unnecessary (one
might say pointless) to declare variables in
IDL like this, since IDL types variables on
the fly. In other words, this is perfectly
acceptable in IDL:
xlist = fltarr(1000)
xlist = 5
Since IDL is going to ignore the first statement
anyway, why type it? You can get along just
creating your variables the way you like without
declaring them:
xlist = findgen(1000)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|