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

Home » Public Forums » archive » Adding x,y events to a 2d array (quickly)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Adding x,y events to a 2d array (quickly) [message #86425] Thu, 07 November 2013 04:45 Go to previous message
oliver[1] is currently offline  oliver[1]
Messages: 3
Registered: November 2013
Junior Member
Hi

This may be a much answered question, but searching for an answer has failed me.

I have 3 (very large) arrays giving x values, y values and energy values.

I wish to create two 2d arrays - one of total (summed) energy for a particular x,y value, and one of total counts per x,y value.

An example of what I tried is below:

x=[1,1,2]
y=[1,1,2]
e=[10,10,10]

To create the 'counts' value, i used the following:

counts=fltarr(5,5)

counts(x,y)++

This works. You end up with a value of 2 at position(1,1) and a value of 1 at position (2,2).

I hoped to get the 'total energy' value by doing the following:

totalenergy=fltarr(5,5)

totalenergy(x,y)+=e

However, this does not work. The final array only contains the last energy value added at each point.

Is there an IDL trick I'm missing that allows you to incrementally add values to an array quickly?

Thanks

Oliver
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Non-blocking socket
Next Topic: strange !P.multi[0] behavior??

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

Current Time: Wed Oct 08 13:39:41 PDT 2025

Total time taken to generate the page: 0.00477 seconds