In a script(outside of GUI), how to execute button callback function in GUI?

3 visualizzazioni (ultimi 30 giorni)
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.

Risposte (2)

Jan
Jan il 13 Dic 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.

Chenghao
Chenghao il 13 Dic 2012
Thank you for your reply. In addition, the mentioned GUI program is a complex open source program, not I implemented.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by