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

Home » Public Forums » archive » The limits of !NULL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
The limits of !NULL [message #83938] Wed, 17 April 2013 19:52
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
Having only recently started switching to IDL8 thinking, I decided today
to try out the WHERE(/NULL) functionality. And the first thing I tried
to do failed miserably.

I think the fundamental problem is that !NULL doesn't seem to be at all
useful on the RHS of an equation. What I wanted was to shorten:

a = where(array eq value, na)
if na gt 0 then begin
data1[a] = -data1[a]
data2[a] = -data2[a]
endif

to:

a = where(array eq value, /null)
data1[a] = -data1[a]
data2[a] = -data2[a]

since I thought the general idea of this functionality was so that you
no longer had to test for no matches. However, when the condition is not
met, it fails miserably:

IDL> data1[a] = -data1[a]
% Variable is undefined: <UNDEFINED>.
IDL> help, a
A UNDEFINED = !NULL

If a is used only on the LHS, it works fine:

IDL> data1[a] = 5
IDL>

But even if the RHS is implicit, it fails:

IDL> data1[a]++
% Variable is undefined: A.

So I guess I'm sticking with the original coding paradigm.

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: custom x axis
Next Topic: Re: The limits of !NULL

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

Current Time: Wed Oct 08 17:08:30 PDT 2025

Total time taken to generate the page: 0.00624 seconds