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

Home » Public Forums » archive » Re: Incrementing an Array
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: Incrementing an Array [message #24902 is a reply to message #24901] Fri, 27 April 2001 14:14 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
s007amf@news.wright.edu (ALAN FRAZIER) writes:


> Once again I am struggling with the finer points of IDL. What I am trying
> to do seems simple, but is causing me some headaches. What I am trying to
> do is this:
>
> matrix[x,y,z] = matrix[x,y,z] + 1
>
> Where matrix is a 3D array and x,y,z are 1D arrays. Matrix starts out
> all 0's and I am trying to increment values at elements [x,y,z]. The
> problem
> is that some elements should be incremented multiple times. All the
> proper elements are incremented once, but the second, third,
> fourth....increments are not showing up. Any ideas? I know that I could
> write this with loops, but that would be too slow.

This is a common error using array indices. The problem is that each
element evaluated in parallel, not in sequence.

You really want to use HISTOGRAM for this one. JD Smith wrote an
n-dimensional histogramming function which you can find here:

http://cow.physics.wisc.edu/~craigm/idl/archive/msg05549.htm l

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Previous Topic: Incrementing an Array
Next Topic: R: AAARGH!!! IDL5.2 crashes with CALL_EXTERNAL

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

Current Time: Sat Oct 11 15:08:36 PDT 2025

Total time taken to generate the page: 0.95827 seconds