You can achieve this using dynamic programming in Matlab.
Here is an example code:
main.m445 chars19 lines
This script generates a random matrix A with dimensions n by m. It then defines an increment k for the number of columns to average per iteration. A new matrix B is initialized with dimensions n by fix(m/k). Finally, the script iterates through every k columns in A, averages the values in the column range, and stores the result in B.
gistlibby LogSnag