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

Home » Public Forums » archive » 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 #33834 is a reply to message #33735] Fri, 31 January 2003 15:35 Go to previous message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
Hello Doug,

All I know is that it is a feature, not a bug. Subscripting a
variable with an array of indices returns an array of the same
size. Where the index numbers undershoot (-ve values) the
output gets filled with the first element and where the index
numbers overshoot, those get filled out with the last element.

Look under the "Array Subscripts" section of the online help.

Vinay

In article <20030131103101140-0600@news.tc.umn.edu>,
Doug Rowland <rowland@fields.space.umn.edu> wrote:
> 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
--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-143] 617 496 7173 [F]
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: PNGs with alpha channel?
Next Topic: Polyfill, z-buffer & postscript

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

Current Time: Sun Oct 12 00:08:58 PDT 2025

Total time taken to generate the page: 1.76090 seconds