Supress image showing until called on Live Script

조회 수: 1 (최근 30일)
Miguel Romanello Joaquim
Miguel Romanello Joaquim 2021년 1월 3일
편집: Maximilian Schönau 2021년 1월 3일
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.

답변 (1개)

Maximilian Schönau
Maximilian Schönau 2021년 1월 3일
편집: Maximilian Schönau 2021년 1월 3일
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

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by