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

Home » Public Forums » archive » Re: Negative indexing and the WHERE function in IDL 8.0
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: Negative indexing and the WHERE function in IDL 8.0 [message #72175 is a reply to message #72166] Wed, 18 August 2010 09:31 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

A possible solution is to use the new /NULL keyword to WHERE:

data = [1,2,3,4]
data[WHERE(data eq 5, /NULL)] = 999
print, data
1 2 3 4

If /NULL is set, and there are no matches, then WHERE returns the new !
NULL "empty array". In IDL 8.0, if you are indexing into an array, and
any of the subscripts are !NULL, then the indexing is quietly skipped.

This solution still requires you to examine your old code carefully
and retrofit it, but it's a lot easier to add a /NULL to your WHERE
calls than to implement the error handling for the -1.

Hope this helps.

-Chris
ITTVIS
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FITS WCS routines
Next Topic: obj_destroy on IDL_IDLBridge hangs sometimes

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

Current Time: Wed Oct 08 19:32:02 PDT 2025

Total time taken to generate the page: 0.00471 seconds