Re: Create new arrays from series of subsequent integers in an existing array [message #48794 is a reply to message #48793] |
Wed, 24 May 2006 15:59   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Wed, 24 May 2006 16:23:52 -0600, David Fanning wrote:
> JD Smith writes:
>
>> 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.
>
> OK, I don't honestly know what it means either way, but I
> fixed it to indicate both are correct. :-)
It's just the difference between data[[1,2,3,4,5]] and data[1:5]. No big
deal. If you want to add "6", it's easier to use the second form than the
first.
JD
|
|
|