How can I modify and return variables between GUIs?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, so I have come across different webpages describing similar problems but could not pin-point the origin of my project exactly.
Problem is as follow: suppose you have a main GUI that provides access to a certain algorithm that uses default parameters. Then you want to provide access to some kind of "Advanced Settings" for the expert user to change those parameters.
I am able to perform all these operations but, when it's time to close the second GUI and retrieve the updated values for the parameters, I only retrieve the default ones I have used to start the second GUI and not the user-updated ones.
Here you can find simplified code describing the problem: https://www.dropbox.com/sh/5215sfxhrqjml5c/52KiuVSFmZ
Thanks, Francesco
댓글 수: 0
채택된 답변
Iain
2013년 6월 6일
You can pass them in the same way that functions pass variables around:
"Global" variables
Passing arguments
Putting the variables in the "userdata" of graphics objects. set(h,'Userdata',var)
Using a "current" file, where everything is passed around.
댓글 수: 3
Iain
2013년 6월 6일
I think if you pass a handle from gui #1 into gui #2, so that the code in gui #2 has access to that handle you can pass it across with a set(h,'userdata',...).
I also think that you could write the second gui as a function, which can only complete when you close that gui, so that gui #1 just thinks that the call to generate gui #2 is long.
추가 답변 (1개)
Jan
2013년 6월 6일
Sorry, Francesco, reading and understanding your files would require much more time than I like to spend for an answer. Could you narrow down theproblem and specify in which part of which file the problem occurres?
Did you e.g. use the debugger by setting a breakpoint into the lines you expect to perform the wanted operations? Then stepping through the code line byb line will reveal, what's going on.
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!