Is it possible to use GUI's callback functions with another Matlab program?
1 view (last 30 days)
Show older comments
I've made a GUI program in Matlab that can manage a controller. With it I can comunicate with a controller easily with the usage of callback functions that are implemented in it. Now, I would like to make another program for another purpose and in it I would like to use/call those same functions. Can anyone tell me is this possible to do it this way or I will need to do it differently?
0 Comments
Accepted Answer
Jan
on 6 Oct 2017
Did you implement the code for the communication with the controller directly in the callback functions of the GUI? This would be a pity.
Prefer to keep the data, the code for the calculations and the GUIs separated as clear as possible. Then you can modify each of them independent from the other parts. In your case this would have the advantage, that you can call the function for the communication directly without the need of the indirection over the GUI. The callback from the GUI would grab the values of its elements only, and call the external function for the processing.
I recommend to split the code of your GUI callbacks, because this is easier, more flexible and less prone to bugs, than some code to "remote control" the GUI and calling the callbacks magically with constructed inputs.
0 Comments
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks 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!