Anisa: Regarding your latest edit. If you want to do it that way, then you don't need the innermost two loops. Simply do it like this:
I=imread('lena.bmp');
c = mat2cell(I, [32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32], ...
[32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32]);
minOfBlocks=zeros(16,16);
subplot(1,2,1);
imshow(I);
title('Original Image', 'FontSize', 30);
for i=1:16
for j=1:16
a = c{i,j};
minOfBlocks(i,j)=min(a(:));
end
end
subplot(1,2, 2);
imshow(minOfBlocks, []);
title('Min of 32x32 Blocks', 'FontSize', 30);
Best Answer