Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can I call the data from one GUI and display it in another GUI without saving the data in a txt file?
1 次查看(过去 30 天)
显示 更早的评论
Below are my file, i can load the image after i save my uploaded image and use 'imread' in MY second GUI but i want to display the data straight from the previous GUI after i click a button to another GUI. "untitled1.m" and "well.m" is my second GUI.
0 个评论
回答(2 个)
Adam Danz
2018-9-25
编辑:Adam Danz
2018-9-26
If your GUI was made using GUIDE, you can call any callback function within the GUI's m-file from outside of that file. Say your GUI's m-file is named myGUI.m with a function within the file named buttonCallback(). From outside of the file, you can execute the code
MyGUI('buttonCallback',hObject,eventData,handles,...)
which includes all inputs to the buttonCallback() function.
3 个评论
Stephen23
2018-9-26
编辑:Stephen23
2018-9-26
"If your GUI was made using GUIDE, you can call any nested callback function ..."
GUIDE does not use nested functions, it only uses local functions. Not only that, the MATLAB documentation specifically states that nested functions are "Not recommended for GUIDE apps."
Stephen23
2018-9-26
编辑:Stephen23
2018-9-26
This is simple using guidata, or setappdata and getappdata: instead of using the handle of the callback object as you normally would, you can pass it the handle of the graphics root, so that whatever you store there will be available to all graphics objects. Note that you should not store all of the GUI data (i.e. handles) in the root, just the few bits of data that you want to swap between GUI's, and these should probably be stored in a structure (much like handles).
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!