Info
此问题已关闭。 请重新打开它进行编辑或回答。
Question about preserving variables into GUI
1 次查看(过去 30 天)
显示 更早的评论
Hello, thanks for reading this,
I have a question about a GUI I set up.
Right now, I have a main.m file that first calls a function where I set up variables so I can put them into a workspace, then I call a GUI so I can manipulate the data and display it. So, my m file looks a bit like:
create_data
create_gui
If I manually call the create_data m file within the callback function of the GUI element I want, I can get the result I want, but I don't want to continually call the element, as it wastes memory and cpu time.
Any ideas?
Edit: I tried putting my variables one by one as global variables in my main.m file, but they still couldn't be accessed in my GUI file unless I called the file in the GUI function.
0 个评论
回答(1 个)
Seyhan Emre Gorucu
2012-8-6
It might be more helpful if you write a simple example.
2 个评论
Seyhan Emre Gorucu
2012-8-6
编辑:Seyhan Emre Gorucu
2012-8-6
Well you can try this.
a=3;
save('data.mat','a')
This saves your data into .mat file at the same folder. You can upload it back at the function by:
load('data.mat')
Now the data is visible inside the function.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!