MATLAB: How to prevent figures from being generated without individually turning off Visibility

disablefiguresMATLAB

Is there a way to disable figures from being generated when calling commands that generate one, such as 'plot' or 'bar'? I have a script that generates many figures and I do not want to set each one's 'Visibility' to 'off'. 

Best Answer

Set the 'DefaultFigureVisible' property to 'off'. This will ensure that figures do not get rendered. 
>> set(0,'DefaultFigureVisible','off');
To have figures generated again, set this property to 'on'.