How to share data with a running callback in an App Designer app?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have an App Designer app that executes a while loop (within a callback) once a button is pressed. I want the user to be able to change configurable parameters in the GUI (e.g. a spinner or an edit field) and have those updated values get used by the code currently executing within the while loop running in the original callback.
I've tried having the while loop code read the app.SpinnerName.Value, but this value seems to stay static (from the perspective of the while loop) even though the user can change this value in the GUI while the while loop is executing. I believe this is because the "app" structure that gets passed into the original button callback is a copy of the actual app structure. Is there a way to update or refresh this "app" structure within an executing callback?
I've contemplated alternative approaches to feeding that value in, such as having the SpinnerNameValueChanged callback write the value to a file or perhaps to the base workspace, then having the executing callback read the new value from there (instead of from the app structure), but this strikes me as clunky/inefficient. Any suggestions?
0 Commenti
Risposte (1)
Voss
il 4 Mar 2022
Try including a drawnow() inside your while loop, which will update the graphics so that when subesquent code gets the value of a property of a UI component, the value is up-to-date.
0 Commenti
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!