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 #81766 is a reply to message #81762] Mon, 22 October 2012 04:55 Go to previous messageGo to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
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
[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: Sat Nov 29 09:29:21 PST 2025

Total time taken to generate the page: 0.23865 seconds