how to use push button to create new figure window in gui

10 views (last 30 days)
harish rudraiah
harish rudraiah on 3 Dec 2011
Edited: Henric Rydén on 15 May 2014
Hi everyone, Please help me to create two interactive guis.
Paulo Silva
Paulo Silva on 3 Dec 2011
Create the other GUI the same way and go to the first GUI button callback and put in the code the name of the second GUI or uiwait('NameOfSecondGUI')

Sign in to comment.

Answers (1)

Paulo Silva
Paulo Silva on 3 Dec 2011
First and most important question, are you using GUIDE or doing all in one m-file (programatically)?
The idea is to put some code on the pushbutton callback, usually you call the other GUI just with its name, if you want the first GUI to wait until the second one is closed use something like the uiwait function
Henric Rydén
Henric Rydén on 15 May 2014
Yes there is, using getappdata and setappdata: In the main GUI, put this in the opening function:
in the other gui, do this whenever you need to access the handles from the main gui:
mainHandles = getappdata(0,'mainHandles');
Since you are now storing data in the matlab root, remember to remove the data after you quit the application using rmappdata. To avoid this, you can put all your data in the figure of the main GUI and then all of you data is removed when the figure is closed. In the openingfunction of the main gui:

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!

Translated by