Hello!
I am writing a GUI programmatically (not with GUIDE). Is it possible to close and re-open the GUI with a pushbutton callback within that very GUI? If so, how do I code it? I have been looking everywhere, I cannot find anything.
Thanks so much for any help!

 Akzeptierte Antwort

Jan
Jan am 2 Feb. 2012

2 Stimmen

If the GUI creator function is called OpenGUI:
function PushButtonCallback(ObjH, EventData)
OrigDlgH = ancestor(ObjH, 'figure');
delete(OrigDlgH);
OpenGUI;
end
So simply close the existing dialog and create a new one. Or do it the other way around.

2 Kommentare

Matthias
Matthias am 2 Feb. 2012
Perfect! Thank you very much, Jan!
Dani Tormo
Dani Tormo am 17 Dez. 2012
That works, but how to get the original uicontrol settings?
I am using GUIDE and I set some settings before start: some texts hiden, buttons and edits disabled; the data of edits to a certain value; axes without data, etc.
Do I have to do it manually in OpenGUI?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 2 Feb. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by