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

Re: comparing numbers using WHERE doesn't work



On Sat, 2 Jun 2001, Miklos Z. Kiss wrote:

> Hi folks:
>     I have noticed a strange occurence when I try to compare a number with
> all the elements of an array.  I'll show my situation in an example.
> Consider the following array:
> [snip]
> index0 = WHERE(a EQ x)
> index0 = index[0]  ; convert from 1-D array to single integer.
> index1 = WHERE(a EQ y)
> index1 = index[0]

I'm not sure why this is happening to you. It works correctly on my
machine. But you can simplify your WHERE query and subsequent
array-to-integer like this:

	index0 = ( WHERE(a EQ x) )[0]

-k.


-- 
Ken Mankoff
LASP://303.492.3264
http://lasp.colorado.edu/~mankoff/