comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » N_ELEMENTS and WHERE: Scalar or Array ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: N_ELEMENTS and WHERE: Scalar or Array ? [message #14205 is a reply to message #14130] Mon, 01 February 1999 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
wmc@bas.ac.uk writes:
> ...
> But since this has come up, & its one of my pet peeves: why cannot where
> return a null array to indicate no-elements-match. And then array[null] would
> match to nothing. This would allow one to say
>
> array[where(wurble)]='stoat'
>
> instead of the ugly
>
> i=where(wurble,count)
> if (count gt 0) then array[i]='stoat'
>

Amen brother! It is sadly unfortunate that where(0) returns a number
at all. A null array -- if IDL had them! -- would be the best.

Of course, there is the trade-off between power user and newbie user.
Consider the following:

wh_one = where(x GT 1)
x[wh_ine] = 0 ; NOTE the type

Because of the typo, the second statement would have the mysterious
side effect of having no effect at all! (including no error message) I
would still love to have it, but newbies might go crazy.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Scalp editting??
Next Topic: Map spanning Dateline?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 11:27:12 PDT 2025

Total time taken to generate the page: 0.00575 seconds