MATLAB: How can I load a figure without it appearing

figure

I saved a figure with some other variables in .mat format but each time I load the file the figure automatically appears what can I do to prevent that?

Best Answer

You forgot to explain, how you store the figure and some data in a MAT file. This is not trivial.
Loading the MAT file will recreate the figure. This is also the case if you save the figure in a .FIG file and import it by Data = load('file.fig'). With the old HG1 graphics, this loaded the figure data as a struct, but did not open the figure itself. But with the modern HG2 graphics, importing the struct will open the figure.
You can set the 'Visible' property to 'off', such that the figure does not appear anymore. But this will still create it, which might take some time. The best idea would be, not to store the figure and the data in the same MAT file.