how do i close plotted graph?

1 Ansicht (letzte 30 Tage)
Kritank Kalyan
Kritank Kalyan am 18 Dez. 2018
Kommentiert: Star Strider am 18 Dez. 2018
I am trying to close a graph automatically after 5 second of view

Akzeptierte Antwort

Star Strider
Star Strider am 18 Dez. 2018
Try this:
figure
plot(randn(1, 10))
hf = gcf;
pause(5)
close(hf)
  4 Kommentare
Guillaume
Guillaume am 18 Dez. 2018
As long as pause is on!
Possibly safer:
hf = figure;
plot(randn(1, 10));
t = timer('StartDelay', 5, 'TimerFcn', @(~, ~) close(hf));
start(t);
Star Strider
Star Strider am 18 Dez. 2018
Good point!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by