The above code keeps referring to the same subplot on each iteration since it is using i/2 for each i in either subplot1 = subplot(2,3,i/2) or subplot2 = subplot(2,3,i/2). A different grid position is needed for each subplot.
There are six iterations of the for loop, so presumably there will be 6 pairs of subplots (so 12 subplots in total). Is this correct? The above code indicates that there will be six iterations (due to the 2:2*12) but then a 2x3 is defined using subplot (for only 6 subplots) hence the confusion. If we assume the the six pairs then we can do the following
for i = 2:2:12
[C,L,p,S] = func1(n,i);
subplot1 = subplot(6,2,i-1);
semilogx(p,C,p,L);
subplot2 = subplot(6,2,i);
semilogx(p,S);
end
From http://www.mathworks.com/help/matlab/ref/subplot.html, MATLAB numbers its grids by row, such that the first grid is the first column of the first row, the second grid is the second column of the first row, and so on. So the two grids in the first row are accessed by 1 and 2, the two in the second row are accessed by 3 and 4, etc. Since i is a multiple of 2, then on the first iteration we want to update subplots/grids 1 and 2 (so i-1 and i for i==2), on the second iteration we want to update subplots/grids 3 and 4 (again, i-1 and i for i==4), etc. That is why the above uses subplot(6,2,i-1) and subplot(6,2,i).
Try the above and see what happens!