MATLABHiddenFigure

From WikiMEG
Jump to: navigation, search

When generating many figures in a loop, MATLAB will pop up the figure, taking focus away from whatever you are doing.

To avoid this, we can create a hidden figure,

f = figure('visible', 'off');
plot(randn(10))
print('-dpng', 'randn.png');
close(f)

Even though the figure is hidden, we can still print it to a file & close it.