Strange array division problem [message #66296] |
Mon, 04 May 2009 14:42 |
David Klassen
Messages: 27 Registered: December 2004
|
Junior Member |
|
|
I'm trying to create an array by reading in 2-d data and putting into
planes in a 3-d array, however, some of the data is redundant---the 2-
d data would go into the same plane. In these cases, I want to
average them so I figure I can just add the data to the current plane
value, keeping track of how many data arrays go into each plane, then
just divide the final 3-d array by these counts. But I'm stuck on how
exactly to implement that.
My 3-d array X columns, Y rows, Z planes and the 2-d array is Z
columns by Y rows (so I'm "rotating" the data and "sliding" each one
into a column of the 3-d array---I hope that makes sense). I then
have a vector, xcounts, that is X elements long and as data go into
the columns, I increment xcounts[X].
So, when I'm done populating the 3-d array I need to divide each row
in each plane by the vector xcounts. Is there an easy way to do this
that doesn't involve me looping through all the points?
|
|
|