MATLAB: How to plot partial results of a for-loop in one figure and create different figures for other results

figurefor loopiterative plottingMATLAB and Simulink Student Suiteplot

I have a for loop, which reads in and evaluates the run-off values for various years. There are several time series for each year. So I have an ensemble of time series per year. Now I want to create a figure for each year, in which the respective ensemble is presented.
The following code section shows the plot function for the year 2014 as an example:
sdatelim=[datenum(2014,05,01) datenum(2014,10,01)];
dt = 1/24;
sdate2014 = sdatelim(1):dt:sdatelim(2);
figure('Position',[200 100 900 900],'PaperPositionMode','auto','Color','w');
a(1) = axes;
set(a(1),'Position',[0.09 0.09 0.80 0.80],'fontsize',13)
hold on;
plot(sdate2014(1:3672),Qs2014,'.'); hold on;
% the next figure for the subsequent year
... figure(...); hold on;
a() = axes ...
plot (sdate2015(1:3672),Qs2015); hold on;
Regardless of whether I add the figure command before the loop or add the hold on, always a separate figure is opened.
This is a solution that did not work.
Now my questions are:
  1. How can I create multiple figures with the corresponding ensemble (that means e.g. all time series for the year 2014 in one figure)?
  2. How can I change the line color within a figure for a few thousand ensemble members?

Best Answer