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
last array index subscript [message #33735] Thu, 23 January 2003 09:50 Go to previous message
Chad Bender is currently offline  Chad Bender
Messages: 21
Registered: July 2001
Junior Member
Hi --

Is there a way in IDL to directly reference the last element of a vector
without first determining how many elements the vector contains?

For example, something like:

n=N_Elements(my_array)
value=my_array[n-1]

except without having to make the call to N_Elements. Granted, avoiding
the N_Elements call probably doesn't save a lot of time. But I figured
that with all of the complicated syntax that IDL accepts, there might be a
direct way to do this. The Bldg Apps guide says you can extract a
subarray from some element e to the end of the array like this:

subarray=my_array[e:*]

So it seems to me that IDL knows what that last index is. I tried
something like:

value=my_array[*-1], but (not unexpectedly) this caused a syntax error.

I figure that what I want is probably impossible, but if anyone knows how
to do it your advice is appreciated.

Thanks
Chad Bender
[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: Wed Oct 08 19:03:26 PDT 2025

Total time taken to generate the page: 0.00462 seconds