I want to export my data in two figures with four subplots each. But when I try to do this inside a loop it keeps printing only the second figure with four plots. And when I use figure, it prints eight figures with one plot each. Here is the part of code:
subplot(2,2,k);
plot(2.^[4:2:10], a, '-mo', 2.^[4:2:10], b, '-r+', 2.^[4:2:10], c, '-bx' );
axis([2.^4, 2.^10, 0, max([max(a), max(b), max(c)])]);
str = sprintf('Time for m1 = 2^%d',i);
title(str);
xlabel('n ')
ylabel('s')
subplot(2,2,k);
plot(2.^[4:2:10],a1, '-mo', 2.^[4:2:10], b1, '-r+', 2.^[4:2:10], c1, '-bx' );
axis([2.^4, 2.^10, 0, max([max(a1), max(b1), max(c1)])]);
str = sprintf('Time for m1 = 2^%d',i);
title(str);
xlabel('n ')
ylabel('M')
figureand the essential part of the loop