How to use a same variable to functions in Gui?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Daniel Fonsêca
il 16 Ott 2018
Modificato: Stephen23
il 30 Ott 2018
I have used the Gui to build the a programm. I would like when the user to click on menu item A, a number is stored in a variable. When the user click on menu item B, another number is stored in the same variable.
I want to use this variable in other function, in a loop. So, I'm trying that. Since now, I thank you for attention.
2 Commenti
Shameer Parmar
il 19 Ott 2018
Modificato: Shameer Parmar
il 19 Ott 2018
Are you sure you want to click on menu item ? OR you want to say push button of GUI?
Risposta accettata
Daniel Fonsêca
il 23 Ott 2018
3 Commenti
Stephen23
il 30 Ott 2018
Modificato: Stephen23
il 30 Ott 2018
@Daniel Fonsêca: you change your approach to writing GUI's.
A much better approach is to pass the data to a GUI when it is called, process the data entirely within the GUI workspaces, and then return the data when the GUI closes (the waitfor command is critical here). A lot of well written code loads, processes data, and saves all without touching the base workspace at all.
See this for a simple example of passing data into and back from a GUI:
Clearing a workspace is rarely required in well written code: functions, which have independent workspaces, have their memory usage managed automatically by MATLAB.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Workspace Variables and MAT Files 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!