フィルターのクリア

set and get on two gui

1 回表示 (過去 30 日間)
pink
pink 2011 年 6 月 12 日
I made two gui, gui A (input) and gui B (table), when I enter data into gui B, the data is lost and only appear later in case of error, so I need your advice
??? Error using ==> setappdata Invalid object handle
Error in ==> gui_mainfcn at 242 setappdata(gui_hFigure,'GUIOnScreen', 1);
Error in ==> main at 40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
Error in ==> inputmaterial>okbutton_Callback at 77 mainGUIhandle = main;
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> inputmaterial at 16 gui_mainfcn(gui_State, varargin{:});
my code
function okbutton_Callback(hObject, eventdata, handles)
% hObject handle to okbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mainGUIhandle = main;
mainGUIdata = guidata(mainGUIhandle);
inputmaterial=get(handles.applybutton,'UserData')
set(mainGUIdata.table1,'data',inputmaterial)
guidata(main, mainGUIdata);
close

採用された回答

Paulo Silva
Paulo Silva 2011 年 6 月 12 日
The error is in the line:
mainGUIhandle = main;
In that context MATLAB doesn't know what the variable main is because it's not defined, maybe you can use:
mainGUIhandle = gcf;
or
mainGUIhandle = handles.figure1;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by