How to make my window close on a timer

does any one known how to make a timer so that it closes the window that im using? Im trying to make a window pop up in GUI stay for like 20 seconds then close on its own. Please help

1 commentaire

Geoff Hayes
Geoff Hayes le 27 Août 2014
Rainaire - what kind of window are you popping up? Another GUI or some kind of dialog?

Connectez-vous pour commenter.

Réponses (1)

Bruno Pop-Stefanov
Bruno Pop-Stefanov le 29 Août 2014
>> f = figure;
>> t = timer('ExecutionMode','singleShot','StartDelay',20,'TimerFcn',@(~,~)close(f));
>> start(t)

5 commentaires

Rainaire Hansford
Rainaire Hansford le 3 Sep 2014
So is figure the name of my figure or should I just use the word
José-Luis
José-Luis le 3 Sep 2014
f is the handle of your figure. It is a number. Click on your figure and then try gcf in the command line. The number returned would be your figure handle.
Asit Kumar
Asit Kumar le 4 Juil 2018
@José-Luis, How do I close if it is a normal PC window, not a MATLAB figure or GUI or dialog?
Jan
Jan le 4 Juil 2018
@Asit Kumar: You mean a window, which does not belong to Matlab? This is new question, so please open a new thread.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by