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

Home » Public Forums » archive » Re: Array indexing problem
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: Array indexing problem [message #37867 is a reply to message #37858] Wed, 28 January 2004 13:34 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Roy writes:

> Is there any existing code that will catch the below IDL simple
> example? Input a and b must be an array.
>
>
> Input is an array:
> IDL> b=[4]
> IDL> a=[0,1,2]
> IDL> print,a[b]
> 2
> This should give me an error.

Alas, you have run into a little known, but enormously
appreciated, little feature of IDL. (I'm sure it is
explained in the manuals somewhere. :-)

Maybe something like this for an error handler:

IF Total(b GT ((N_Elements(a) -1)) GT 0 THEN $
Message, 'B indices exceed bounds of A'

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: V5.6 to V6.0 license server question
Next Topic: Rapid "moving windows" access in IDL?

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

Current Time: Sat Oct 11 03:20:23 PDT 2025

Total time taken to generate the page: 1.20275 seconds