Average every n*n elements in a two dimensional matrix
Show older comments
I have a two dimensional matrix, and create a second matrix with the averages of every n*n elements. So, say I have a 100*100 matrix; I would want a 10*10 matrix where each single element is the average of the 10*10 elements in the original matrix at that location.
So far I have tried splitting the matrix into n separate row vectors, averaging each of those every n elements, concatenating and re averaging ever n of the averaged vectors. Then I concatenate each of those vectors. Is there a more efficient way to do this this, without using so many loops? It is very inefficient and inelegant for such a large matrix.
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!