In a script(outside of GUI), how to execute button callback function in GUI?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Jan
le 13 Déc 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 commentaires
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!