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

Home » Public Forums » archive » Re: last array index subscript
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: last array index subscript [message #33845 is a reply to message #33731] Fri, 31 January 2003 08:30 Go to previous messageGo to previous message
Doug Rowland is currently offline  Doug Rowland
Messages: 12
Registered: March 2002
Junior Member
Vinay,

How does this work? I tried to wrap my brain around this one. Is it an
IDL "bug" or is there some simple rationale for IDL behaving this way?
For example, if I try to directly subscript my_array with the scalar
value 2147483647L (or any other number which is larger than the number
of elements of my_array, less one) I get

IDL> print,my_array[2147483647L]
% Attempt to subscript A with <LONG ( 2147483647)> is out of range.
% Execution halted at: $MAIN$

Why should wrapping this index value in an array suddenly make it work?

Thanks.

Doug

In <3e304dac.0@cfanews.harvard.edu> Vinay L. Kashyap wrote:
> Try
>
> value=(my_array[[2147483647L]])[0]
>
> where the "[[.]]" returns an array and the "(.)[0]" ensures that the
> output is a scalar, and 2147483647L = 2L^(31L)-1L is the largest
> possible I*4 number you can have and surely no will have an array
> bigger than that.
>
> vinay
>
--
------------------------------------------------------------ -------------------------------
Doug Rowland 472 Tate Laboratory of Physics
Space Physics Laboratory 116 Church Street S.E.
School of Physics and Astronomy Minneapolis, MN
University of Minnesota 55455

work: (612) 624-0378 email: rowland@fields.space.umn.edu
fax: (612) 624-4578
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cropping of IDLgrVolume?
Next Topic: Re: formatting array output?

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

Current Time: Sat Oct 11 12:23:49 PDT 2025

Total time taken to generate the page: 0.87855 seconds