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

Home » Public Forums » archive » IDL array subscripting issue
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: IDL array subscripting issue [message #90229 is a reply to message #90227] Thu, 12 February 2015 10:26 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 02/12/15 12:29, Fabien wrote:
> On 12.02.2015 18:22, David B wrote:
>> ===============================
>>
>> IDL> a = INDGEN(10)
>> IDL> b = [0,10]
>> IDL> print, a[b]
>> 0 9
>> IDL> b = [0,9]
>> IDL> print, a[b]
>> 0 9
>>
>> ===============================
>> Why?!
>
> This is a strange but documented feature of IDL:
>
> http://www.exelisvis.de/docs/Using_Arrays_as_Array_Su.html
>
> See "Array Subscripts and Clipping".
>
> Depending on what you want, this is a feature of a bug. I learned to
> like it as a feature, personally.

I really like the use of negative indices to reference from the end of
the array. The above url has the following "note" in the section about
clipping:

<quote>
Note: Because of the confusion between the clipping of array subscripts
and the use of negative indices (see the next section), it is best to
avoid using code that relies on this clipping behavior.
</quote>

Just sayin'. Not judging.

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Variable attributes and undef vars
Next Topic: CURVFIT with XY error

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

Current Time: Wed Oct 08 17:03:09 PDT 2025

Total time taken to generate the page: 0.00367 seconds