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

Home » Public Forums » archive » what is the highest subscript in the array?!?
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: what is the highest subscript in the array?!? [message #70852 is a reply to message #70774] Fri, 07 May 2010 08:37 Go to previous messageGo to previous message
eddie is currently offline  eddie
Messages: 1
Registered: May 2010
Junior Member
> PS:  Right before I posted this, I searched and  I figured that
> array[[-1]] should return the highest array value... but it doesn't,
> and I'm still stumped.

Add a 'u' and it should. A negative unsigned number "wraps" to
produce a large number.

IDL> array = indgen(10)
IDL> print,array[[-1u]]
9
This is similar to Carsten's huge number as an index. You can use
array[[-1ull]] if you are concerned that your array might have more
than a gajillion elements.

Unfortunately this trick only works for the last element, array[[-2u]]
still returns the last element of the array, not the second to last.

Cheers,
eddie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plotting 3D array as a 'cloud'
Next Topic: Re: Begin-End matching in IDLDE?

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

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

Total time taken to generate the page: 0.00404 seconds