How to pass data among different MATLAB GUI figures?

3 views (last 30 days)
Good day! I would like to ask how to pass data among different MATLAB GUI figures. I tried passing the data from a popupmenu (GUI1) to static text (GUI2) and it worked, however, when I tried passing the the same data from GUI2 to GUI3 (but this time GUI3 needs to depend on GUI2), I encountered errors. I used the link as my guide: http://www.mathworks.com/matlabcentral/answers/238213-how-to-use-copy-the-chosen-option-from-pop-up-menu-to-another-gui-window
GUI1 contains popupmenu, push button
GUI2 contains static text, push button
GUI3 contains static text, push button
GUI4 contains static text, push button
GUI5 contains static text, push button
When the push button is pressed, it leads the user to the next GUI figure.
I have tried the code below though it did not give me errors, it didn't display anything on the static text.
H = findall(0,'tag','t0');
set(handles.t1,'string',get(H,'string'))
I am planning to pass the data on each GUI while each of them depends on the previous GUI.

Answers (2)

Walter Roberson
Walter Roberson on 6 Sep 2015
set(handles.t1,'string',get(H,'string'))
  3 Comments
Walter Roberson
Walter Roberson on 7 Sep 2015
If that does not work then one of
  • handles.t1 is the handle to a uicontrol of style 'slider' or 'frame', as neither of those styles display the string; or
  • handles.t1 is 'visible' 'off' or contained in something with 'visible' 'off'; or
  • handles.t1 is positioned off of the screen; or
  • handles.t1 is not a uicontrol or a text() object but is some other kind of object that happens to have a String property that happens to be configured in such a way that there was no visible consequence to changing the String property; or
  • handles.t1 is the handle of some other kind of object that has no String property and you failed to notice (or mention) the error message; or
  • handles.t1 was formerly the handle of a uicontrol but the uicontrol has been deleted and you failed to notice the error message; or
  • the string property of t0 is the same thing as the existing string property of t1 so there was no visible change; or
  • the string property of t0 is empty and you failed to notice (or mention) that the field was being cleared; or
  • you are expecting an immediate update and are not getting one because you have not used drawnow() or pause() or figure() or uiwait() or waitfor() or had your code return to the command line; or
  • you have multiple active graphic objects with Tag 't0', so the get() of their String property is returning a cell array of strings and the set() of that cell array of strings into the String property of t1 happens to make it look like there is no change, because t1 happens to be configured in such a size that only 1 line is visible.
Mary Requilman
Mary Requilman on 14 Sep 2015
Even if I tried making a new static text box, the data from GUI2 to GUI3 won't transfer. Is there any other way to pass texts from static box of GUI2 to the static box of GUI3?

Sign in to comment.


Image Analyst
Image Analyst on 7 Sep 2015
  2 Comments
Mary Requilman
Mary Requilman on 14 Sep 2015
Can you suggest a way on how to transfer a plain text (for an example: a two-digit number) displayed by static text box on GUI2 to the static text box on GUI3? Because the link that you provided as I assume stores global values. Also, I would like to ask what does rmappdata do?
Image Analyst
Image Analyst on 14 Sep 2015
The link tells you to look at Geoff's answer, which tells you how to deal with multiple GUIs.
I've never used rmappdata. Apparently it can remove data you've inserted with setappdata. Why do you want to do that?

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!