# How do I subplot multiple tiles that I divided from a satellite image in one figure?

3 views (last 30 days)
Oanh La on 4 Aug 2020
Commented: Image Analyst on 4 Aug 2020
I have to divide my satellite image into 256 tiles of 500 by 500 pixels. I use mat2cell function to do that. After that I want to see the result by displaying in one figure.
Here is my code :
tiles=zeros(500,500);
tiles = mat2cell(TOARef_B{5}, [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 261], [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 101]);
for m=1:16
for n=1:16
subplot(16,16,256); imshow(tiles{m,n});
end
end

Sriram Tadavarty on 4 Aug 2020
Hi Oanh,
You can try the following, since you are there are 16 x 16 tiles.
tiles=zeros(500,500);
tiles = mat2cell(TOARef_B{5}, [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 261], [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 101]);
k = 1; % to index the subplot
for m=1:16
for n=1:16
subplot(16,16,k); imshow(tiles{m,n});
k = k+1;
end
end
Note, this will create very small sub-tiles since the size is 256.
Hope this helps.
Regards,
Sriram
Oanh La on 4 Aug 2020
That's great!
It works well,
Many thank Sriram!

KSSV on 4 Aug 2020
count = 0 ;
for m=1:16
for n=1:16
count = count+1 ;
subplot(16,16,count); imshow(tiles{m,n});
end
end
##### 3 CommentsShow 1 older commentHide 1 older comment
KSSV on 4 Aug 2020
Thanks is accepting/ voting the answer..:)
Image Analyst on 4 Aug 2020
I think they're recommending imtile() over montage().