Set the Variable 'Global' in GUI?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Azzi Abdelmalek
2013-5-11
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
更多回答(1 个)
Image Analyst
2013-5-12
Just say
global yourVariable;
in any function that needs to access the variable.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!