Re: where for only one [message #8854] |
Tue, 06 May 1997 00:00 |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
On Mon, 5 May 1997, R. Bauer wrote:
> Is there a switch for where which will stop the where function after it
> founds the first value belonging to an equation?
> I do not like that's where will look to the end of the data after it
> found the first value.
You could try the MAX() function instead.
Although it will still churn through the whole input array, it will only
return the first index "found". Also, it's probably a bit more memory-
friendly than WHERE().
e.g.,
j=findgen(20)
junk=max(j ge 10.0,indx) ;the expression is just a bytarr of 0s and 1s
help,indx
; INDX LONG = 10
; You could also test for (junk eq 1b) to see that you had at least 1 "hit".
Peter Mason
|
|
|