global variable in different GUI
显示 更早的评论
hi, i'm trying to create a small gui program, there will be a sequence a many gui fiures, iwould like to pass data from one data to another when clicking on next button that will open a new window and close the current one, first i tried to write data in an xls file, but it made my program very slow, then i tried to create a global matrix 'data' in the first window, but the problem is that while passing to the next window all data were lost even though i declared global variable in every function.
1 个评论
Friedrich
2012-2-1
maybe its better not to use global variables. similar question was asked here:
http://www.mathworks.com/matlabcentral/answers/5447-passing-data-between-two-different-gui-window-using-guide
回答(1 个)
Jan
2012-2-1
1 个投票
Global data are not lost, if you implement them without a bug. So either find the bug and eliminate it or avoid using globals. The later is a good programming practice.
Are multiple GUIs open at the same time? If not, can you implement them as panels in the same figure? Then the values can be stored by guidata easily.
类别
在 帮助中心 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!