How to reduce a matrix size
Show older comments
I want to reduce the size of a matrix (M,N) by a fourth by averaging the values of neighboring cells.
So for instance the cells (1,1), (1,2), (2,1) and (2,2) in the old matrix will now be represented by their average which will be stored in (1,1) of the new matrix.
How can I code this?
Thanks!
Accepted Answer
More Answers (1)
Christian Zitzmann
on 9 Jun 2020
The question is very old and propably already solved, but I've got a very nice solution as well.
X = reshape(1:400,20,20);
Y = imresize(X,[3,3]);
1 Comment
Martin Grden
on 1 Jun 2021
Nice, it helped me.
Categories
Find more on Matrix Indexing 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!