Re: N_ELEMENTS and WHERE: Scalar or Array ? [message #14273 is a reply to message #14130] |
Wed, 03 February 1999 00:00  |
Annette Schloss
Messages: 1 Registered: February 1999
|
Junior Member |
|
|
Hi Rose,
you can do this:
non_zero_xvalues = WHERE (subarray1 GT 0, count)
if (count ne 0) then do something
Count will be zero if nothing satisfies the WHERE, otherwise it will be a
positive number.
Does this help?
-Annette
rmlongfield@my-dejanews.com wrote:
>
> Hi All, I keep making the same mistake with N_ELEMENTS so I decided
> to write and ask if anyone has found a solution. I use WHERE to find some
> zeroes in a data set which I want to exclude in further processing. Problem
> is that sometimes they are all zeroes. Using a simple :
>
> non_zero_xvalues = WHERE (subarray1 GT 0)
> IF(non_zero_array EQ -1) ...
>
> gets me into trouble because, when it is an array, I get an error. If I use
> N_ELEMENTS(non_zero_array) there is always at least one element, whether it
> is -1 or something else. I don't like ignoring the 'something else' value
> just because it is the only one. Is the answer another IF statement or some
> sort of error control?
>
> Thanks !
> Rose
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
@ Annette Schloss annette.schloss@unh.edu
@ Complex Systems Research Center fax: 603-862-0188
@ 39 College Rd., U. of New Hampshire phn: 603-862-1792
@ Durham, NH 03824
|
|
|