필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
harish rudraiah
harish rudraiah 2011년 12월 3일
편집: Henric Rydén 2014년 5월 15일
Hi everyone, Please help me to create two interactive guis.
  댓글 수: 2
harish rudraiah
harish rudraiah 2011년 12월 3일
i am using guide to create guis...please tell me the call back code for push button to create new gui
Paulo Silva
Paulo Silva 2011년 12월 3일
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')

댓글을 달려면 로그인하십시오.

답변 (1개)

Paulo Silva
Paulo Silva 2011년 12월 3일
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
  댓글 수: 4
Alireza Faraji
Alireza Faraji 2014년 5월 15일
In this way you will just have a new GUI. But how can we make GUIs talk to eachother. I mean if you want to pass some information from first GUI to second GUI how do we do it?
I though probably we could save the information that we want to give to second GUI in a mat file and load it in the second GUI.
But is there a way that GUIs could talk to eachother directly?
Henric Rydén
Henric Rydén 2014년 5월 15일
편집: Henric Rydén 2014년 5월 15일
Yes there is, using getappdata and setappdata: In the main GUI, put this in the opening function:
setappdata(0,'mainHandles',handles);
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:
setappdata(0,'hMainGUI',gcf);
setappdata(gcf,'mainHandles',handles);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by