Average every n*n elements in a two dimensional matrix
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Neighborhood and Block Processing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!