Is there a way to create subplots dynamically in matlab ?
I have a variable X that determines the number of graphs to be plotted, i was wondering if there was a way to dynamically create these graphs since X will vary according to a certain scenario
I currently allocate the number of subplots beforehand like so:
figure
ax1 = subplot(3,1,1);
ax2 = subplot(3,1,2);
ax3 = subplot(3,1,3);
plot(ax1,ins,state_vec(:,1),'b',x,100,'r','LineWidth',2)
plot(ax2,ins,state_vec(:,2),'b',x,100,'r','LineWidth',2)
plot(ax3,ins,state_vec(:,3),'b',x,100,'r','LineWidth',2)