필터 지우기
필터 지우기

How to keep figures invisible?

조회 수: 32 (최근 30일)
Lu Maz
Lu Maz 2014년 6월 30일
답변: Lu Maz 2014년 6월 30일
The next code snippet creates an invisible figure.
set(0,'DefaultFigureVisible','off')
plot(randi(10,20,1))
The figures in the next piece of code are visible despite the first line.
set(0,'DefaultFigureVisible','off')
for i = 1:4
fh(1) = figure(1)
subplot(2,2,i)
plot(randi(10,20,1),'color',[1 0 0])
fh(2) = figure(2)
subplot(2,2,i)
plot(randi(10,20,1),'color',[0 1 0])
end
Ik could add the next line...
set(gcf,'Visible','Off')
However then the figure would appear first.
How to keep figures invisible in a loop?

답변 (1개)

Lu Maz
Lu Maz 2014년 6월 30일
Thank you! Setting the current figure by using the set-command solves my problem.
set(0, 'DefaultFigureVisible', 'off');
fh(1) = figure(1);
fh(2) = figure(2);
for i = 1:4
set(0, 'currentfigure', fh(1));
subplot(2,2,i);
plot(randi(10,20,1),'color',[1 0 0]);
set(0, 'currentfigure', fh(2));
subplot(2,2,i);
plot(randi(10,20,1),'color',[0 1 0]);
end

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by