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 #37858 is a reply to message #37853] Wed, 28 January 2004 13:43 Go to previous messageGo to previous message
hunter is currently offline  hunter
Messages: 9
Registered: June 2003
Junior Member
You can also turn off this feature if it offends.

compile_opt strictarrsubs

And you will get an error for the example you mentioned above.

Eli



"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a81d8b95abba27f9897bd@news.frii.com...
> 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: Fri Oct 10 11:15:00 PDT 2025

Total time taken to generate the page: 1.91853 seconds