In a script(outside of GUI), how to execute button callback function in GUI?
3 views (last 30 days)
Show older comments
Hi, all. I have a GUI program(named myGUI) created by guide(). There are several checkboxes and a button which is used to calculate a measure value and then save it to the file according to the two GUI input values and the status of checkboxes. This button function sometimes takes a long time to finish calculation. In order to choose the optimal value of this measure, I want to use this GUI within a loop.
The script is as follows:
--------------------------
A % Known row vector
B % Known row vector
for i = 1:10
myGUI(A(i), B(i)); % Here, I want to execute the button function in myGUI.
end
---------------------------------------------------------------------
My question is :
1) how to execute the button function of myGUI within the loop?
2) how to decide the status whether myGUI finish its final calculation,
Thanks for any help.
0 Comments
Answers (2)
Jan
on 13 Dec 2012
A good programming style is to move the calculations in a separate function, which is called from the callback, but is available from outside the GUI also. Then you can run the operations from the GUI or in "batch-mode" programmatically.
Using the indirection to call the calculations through calling the GUI is less flexible and more complicated.
The general rul is: Keep the data, the calculations and the GUI separately as consequent as possible. Such a modular concept allows e.g. for modifying the GUI without touching the calculations, and vice versa.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps 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!