MATLABHiddenFigure

From WikiMEG
Revision as of 16:48, 10 November 2014 by Duke (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.