Clear Filters
Clear Filters

Sharing data between GUI windows

1 view (last 30 days)
Josef Rozinek
Josef Rozinek on 17 Jun 2013
I am working on a GUI for an instrument. The instrument is accessed via serial communication.
My question is, what is the easiest way to share data between GUI windows?
Say I have a main GUI window, where I press the 'settings' button which pops out sub-GUI. In settings I define the serial communication attributes and set the serial interface via a 'connect' button. Then I return back to the main GUI window and I would like to use the previously set attributes further to send/receive messages to the instrument. That has to be done using the fprintf command, with the parameters set in the sub-GUI window.
Any suggestions? Thanks in advance
Cheers
Josef

Answers (1)

Jan
Jan on 17 Jun 2013
When the "settings" button is pressed in the main GUI, forward the handle of this GUI to sub-GUI. When the sub-GUI is closed, use guidata() to write the values from the sub-GUI to the handles struct (or any other ApplicationData) of the main-GUI.
Sharing data between GUIs is discussed frequently. Searching in this forum allows you to find more details.

Community Treasure Hunt

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

Start Hunting!