I am running fminunc several times in a for-loop to train an one-vs-all classifier. I would like to plot the cost of every iteration, which is no problem for one call of fminunc using the options
options = optimoptions(@fminunc,'...', 'PlotFcn','optimplotfval');
But what I would like is something like to plot every call of fminunc and export every plot into a figure for later use.
I.e. I have my loop which calls fminunc several times with the PlotFcn-Option:
for i=1:num_labels
initial_theta = zeros(n + 1, 1);
all_theta(i,:)=fminunc( @(theta)(lr_costfunction(theta, X, (y == i), lambda)), initial_theta, options );
and would like to add something like this pseudocode
figure()=findobj('Tag','optimplotfval');
end
within the loop, as PlotFcn erases previous plots with each new run.
If there is a better/ other solution than my first thought feel free to correct me.