我有两个名为 masir 的 GUI 和 SetOut
SetOut GUI 是 masir 的子 GUI(按下 masir 上的按钮将打开 SetOut) 要访问 SetOut 中 masir 的数据,我有以下两行代码:
masirGUIhandle = masir;
masirGUIdata = guidata(masirGUIhandle);
但是当我在 SetOut 中工作时,运行这 2 行将运行 masir 的打开函数(在打开函数中,我为变量设置了一些初始值,现在我不想要这些初始值,我需要更改变量的值)所以我不想运行 masir GUI 的 OpeningFcn,我只需要访问 SetOut 中的 masir 数据 我能做些什么来解决这个问题?
任何人都可以帮助我解决这个问题并向我解释更多吗?
I use this easy way for data sharing between GUIs
%In the end of OpeningFcn of Main GUI
setappdata(0,'HandleMainGUI',hObject);
%When you want to edit shared data you must get the handle
HandleMainGUI=getappdata(0,'HandleMainGUI');
%write a local variable called MyData to SharedData, any type of data
setappdata(HandleMainGUI,'SharedData',MyData);
%get SharedData and save it to a local variable called SomeDataShared
SomeDataShared=getappdata(HandleMainGUI,'SharedData');
Don't forget to clean up the data shared in the CloseReqFcn of you main GUI
HandleMainGUI=getappdata(0,'HandleMainGUI');
rmappdata(HandleMainGUI,'MySharedData') %do rmappdata for all data shared
Remember that your GUIs might try to getappdata that doesn't exist, you should first test if it does exist
if (isappdata(0,'HandleMainGUI') & isappdata(HandleMainGUI,'MySharedData'))
%get, set or rm appdata
else
%do something else, maybe loading default values into those variables
end
告诉我更多关于 MainGUI 应该写哪行代码,SubGUI 应该写哪一行代码?
并告诉我 CloseReqFcn 的响应者是什么意思?