I often need to plot 10 images together, but using this code results in small images :
img = rand(400,600);
for i=1:10
subplot(2,5,i);
imshow(img);
title(
Based on the answer of @brechmos, when your subplot number is more than 10 subplot, then his code will trigger a error.
% calculate the row and column of the subplot
row = floor( ii/(ncols+1) ) + 1
col = mod( ii-1, ncols ) + 1
e.g. 4X5 cells, then subplot 11 will be wrongly interpreted as (2, 1), but not (3,1).
Replace it with the code below can fix it:
% calculate current row and column of the subplot
row = floor( (i-0.5)/ncols ) + 1;
col = mod(i-(row-1)*ncols, ncols+1);