Supress image showing until called on Live Script

5 visualizaciones (últimos 30 días)
Miguel Romanello Joaquim
Miguel Romanello Joaquim el 3 de En. de 2021
Editada: Maximilian Schönau el 3 de En. de 2021
I essentially want to create figures on the livescript, but not have them show up on the output location until called on later. As in, create and edit all of the plots first, assign figure number/labels to them, but only have them appear on the output line when called on in a "discussion" section at the end of the livescript.
I have tried using what is usually suggested, which I assume works well for normal scripts:
set(0,'defaultFigureVisible','off')
% and later on
set(0,'defaultFigureVisible','on')
However, the figures still show up on the output line. The only solution I have found is using 'close(fig_label)', but it doesn't seem like I can re-open the figure later.
I assume a solution is creating functions for each individual plot, but I was hoping for something a bit more elegant than that.
Thank you.

Respuestas (1)

Maximilian Schönau
Maximilian Schönau el 3 de En. de 2021
Editada: Maximilian Schönau el 3 de En. de 2021
A quite simple workaround would be, if you save the figure you want to be invisible, then close it and open it again from a file when you need it:
% Example Plot
plot(1,1)
xlabel Test
savefig myfigure.fig
close gcf
% do some work
x = 1;
y = 2;
% now open plot again
open myfigure.fig

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by