Can GUI files share data?
显示 更早的评论
Hello! I'm making an interface using GUI. It has to read some points and make a plot with it and, if I push a button it should move to another interface (another GUI file) and, using the same data, generate a different plot. My question is, is that possible? Can different files share a point and how do I send this point to the second file?
Sorry if it sound a bit far-fetched
回答(2 个)
Sabarinathan Vadivelu
2013-4-19
0 个投票
Yes, You can do. Declare the variables which you need to plot as global. Then you just call the other file. There you can plot.
Image Analyst
2013-4-19
0 个投票
Please refer to the FAQ for possible methods: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
8 个评论
Image Analyst
2013-4-19
If you use global variables, put the global declaration inside every function that needs to "see" that variable. For example:
global variableThatNeedsToBeShared;
Put that in sub1() and sub2() if both sub1() and sub()2 need to see it. sub3() will not see it.
María
2013-4-19
Image Analyst
2013-4-19
Then just write your data out to a mat file and have the other gui read that in.
María
2013-4-21
Image Analyst
2013-4-21
Why complicate things by having two GUIs? Can't you build them into a single GUI?
María
2013-4-21
Image Analyst
2013-4-21
编辑:Image Analyst
2013-4-21
Please upload screenshots of both your GUIs to http://snag.gy. Click on your GUI to make it active. Type alt-Printscreen to capture the active window into the clipboard. Then go to snag.gy and type control-v. Repeat for your second GUI, and tell me the urls for both windows.
María
2013-4-22
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!