Re: Create new arrays from series of subsequent integers in an existing array [message #48797 is a reply to message #48796] |
Wed, 24 May 2006 14:55   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 23 May 2006 16:55:42 -0600, David Fanning wrote:
> Jonathan Wolfe writes:
> I wrote up a slightly different method on my web page:
>
> http://www.dfanning.com/idl_way/avgseries.html
Some remixing there... mostly fine, but at one point you you say
"although not in this particular case" regarding the correctness of
the form of reverse indices indexing. That's actually not true: both
forms are correct, it's just that with the data[index_vector] form,
it's not easy to extend the range of indices by one. You could
actually say:
data[[index_vector,index_vector[n_elements(index_vector)-1]] ]
and this would do it just as well. Using the data[low:high] trick,
where you know you have consecutive indices in your HISTOGRAM bin,
just allows you to append one to the range of indices to recover that
mis sing member of the group. So both are correct, but one is more
convienent.
JD
|
|
|