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

Home » Public Forums » archive » Re: Simple question in IDL, looking for solution, thank you
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: Simple question in IDL, looking for solution, thank you [message #81758] Mon, 22 October 2012 14:37 Go to previous message
Danxia is currently offline  Danxia
Messages: 10
Registered: September 2012
Junior Member
Hey Jeremy,

I haven't read this before, but this is deadly helpful. Thanks a lot.

Danxia
On Monday, October 22, 2012 2:10:16 PM UTC-4, Jeremy Bailin wrote:
> On 10/22/12 7:55 AM, Heinz Stege wrote:
>
>> Hi Danxia,
>
>>
>
>> you didn't ask for a solution without a loop. So here is my simple
>
>> answer:
>
>>
>
>> arr=[5,2,3,1,8,3,1,2,3]
>
>> bcg=[1,2,3,2,1,4,2,3,5]
>
>> sum=intarr(max(arr)+1)
>
>> for i=0,n_elements(bcg)-1 do sum[arr[i]]+=bcg[i]
>
>> print,sum[1:*]
>
>>
>
>> Cheers, Heinz
>
>>
>
>
>
> And of course, if you need a very efficient implementation of this (i.e.
>
> if your arrays have millions of elements), then read the "chunk
>
> indexing" section of JD's HISTOGRAM tutorial
>
> http://www.idlcoyote.com/tips/histogram_tutorial.html (you HAVE read
>
> JD's HISTOGRAM tutorial, right???)
>
>
>
> -Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to make text of axis much larger in idl 8?
Next Topic: cgHistoplot and multiplot

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

Current Time: Sun Oct 12 11:10:39 PDT 2025

Total time taken to generate the page: 0.24160 seconds