global variable in different GUI
Show older comments
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 Comment
Friedrich
on 1 Feb 2012
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
Answers (1)
Jan
on 1 Feb 2012
1 vote
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.
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!