I am trying to plot with hidden Matlab figures to speed up my plotting:
a=1:10; b=-a;
% make invisible plot window
f = figure('visible','off');
g = figure('visible','off');
% figure makes the plot visible again
figure(f)
plot(a)
saveas(f,'newout','fig')
figure(g)
plot(b)
saveas(g,'newout2','fig')
%% load saved figures
openfig('newout.fig','new','visible')
openfig('newout2.fig','new','visible')
The problem is the figure(f) command that makes the plot window visible again. The code plots without figure window when I only have one plot and figure(f) is not called.