I have an 2D array and I would like to average every two values in each line.
For example an incoming array (sizeX=16,sizeY=8) will result into an outcoming array of 8x8.
I have implemented this already, but I was wondering whether you could suggest me a faster way of doing so?
In the Example below the incoming 2D array has a dimension of 768x1536 and the out coming 2D array has a dimension of 768x768.
Thanks a lot!
Solved! Go to Solution.
You can try something like this if you have an even number of points in each row.
First, two comments on your description of your problem and your code:
I think McDuff's suggestion of using Decimate and Average is a good one, but (again) you need to clarify if you are combining rows or columns (McDuff's code combines columns, of course). And don't "hide" the rounding function.