I am trying to close a graph automatically after 5 second of view

 採用された回答

Star Strider
Star Strider 2018 年 12 月 18 日

1 投票

Try this:
figure
plot(randn(1, 10))
hf = gcf;
pause(5)
close(hf)

4 件のコメント

madhan ravi
madhan ravi 2018 年 12 月 18 日
+1 nice and easy
Star Strider
Star Strider 2018 年 12 月 18 日
Thank you!
Guillaume
Guillaume 2018 年 12 月 18 日
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 2018 年 12 月 18 日
Good point!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by