How to keep a GUI in sync with internal state?
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!