Set the Variable 'Global' in GUI?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Alvi Syahrin
il 11 Mag 2013
Commentato: Amirhosein Ghenaati
il 20 Nov 2014
I'm working with MATLAB GUI.
When I'm trying to access the variable which was defined with the push button, it is not defined in the pop up menu. The variables; it should be set 'global', so it is defined in the whole program. And I can use it in any callback.
Do you guys have any idea of how to make the variables 'global'?
Your help will be much appreciated.
Thank you.
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 11 Mag 2013
If you want to use it in any callback use guidata
handles.yourvar=yourvar
guidata(hObject,handles)
To use the variable yourvar
yourvar=handles.yourvar
2 Commenti
Più risposte (1)
Image Analyst
il 12 Mag 2013
Just say
global yourVariable;
in any function that needs to access the variable.
0 Commenti
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks 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!