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 #90230 is a reply to message #90229] Thu, 12 February 2015 10:36 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 12.02.2015 19:26, Paul van Delst wrote:
>
> 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.

Haha, I knew this one would come, and I agree

I mean that I like the fact that array[[-1,2,3,-1]] is not throwing an
error, even before negative indices were added to IDL.

say that you're code relies on following:

inds = [-1,2,3,-1]
out = arr[inds]
p = where(inds lt 0, cnt)
if cnt ne 0 then out[p] = !VALUES.F_NAN

How would write the snipset above with
STRICTARRSUBS compile_opt?
[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:09:45 PDT 2025

Total time taken to generate the page: 0.00430 seconds