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

Home » Public Forums » archive » Re: bounds check in array subscripts
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: bounds check in array subscripts [message #16733] Fri, 20 August 1999 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Mark Fardal <fardal@weka.astro.umass.edu> wrote in message
news:7vlnb6i69g.fsf@weka.phast.umass.edu...
> just noticed something odd, running IDL 5.1 on a Debian Linux Pentium box.
>
> IDL> x = findgen(3)
> IDL> subs = indgen(10)
> IDL> print, x(subs)
> 0.00000 1.00000 2.00000 2.00000 2.00000
2.00000
> 2.00000 2.00000 2.00000 2.00000
> IDL> print, x(9)
> % Attempt to subscript X with <INT ( 9)> is out of range.
> % Execution halted at: $MAIN$ 1 sfr.pro
> is this the expected behavior?

Yes. The following quotes are from the IDL 5.2 document 'Building IDL
Applications', section 'Subscripts'.

IDL> ? subscript examples
"If an attempt is made to reference a nonexistent element of an array using
a scalar subscript (a subscript that is negative or larger than the size of
the dimension minus 1), an error occurs and program execution stops."

IDL> ? array subscripts
"If an element of the subscript array is less than or equal to zero, the
first element of the subscripted variable is selected. If an element of the
subscript is greater than or equal to the last subscript in the subscripted
variable (N, above), the last element is selected."

Cheers,
Liam.
[Message index]
 
Read Message
Previous Topic: Problem array subscripting
Next Topic: ENVI 3.2 now shipping

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

Current Time: Wed Oct 08 20:13:26 PDT 2025

Total time taken to generate the page: 0.00263 seconds