How to keep a GUI in sync with internal state?

3 views (last 30 days)
Hello, everyone.
My question is the following:
Suppose you have a fairly large figure with many tables and other components.
What is displayed on this components is defined as a function of come internal state. For example, you have a structure in "guidata", which contains some geographical information, and your gui has a map to display the objects and some lists/tables to list them. The displayed information may also depend on external calls. For example, the displayed behaviour may depend on requests to a meteo server to get weather information.
This structure may get modified by various means: user modifies with figure controls, creates some files in a directory or maybe even directly via matlab console.
What I want is a (relatively) synchronized state of the GUI with the data structure. In fact, I have a function "refresh_view", which does the display, and in theory, I could create a timer object which would call it once in a while, but(!) I want to something more efficient. Say, I'd like the refresh function to be called only when the state structure is changed.
Could I do that?
Theoretically, I'd like something like waitfor(gcf, state). I'd call it in a separate thread and it would be running in an endless loop sleeping, waiting for state changes.
Any suggestions?

Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!