我有一個使用MATLAB GUIDE創建的GUI。我試圖從GUI中返回一個值。下面是代碼的相關部分(完整的代碼可以發現):GUIDE中的句柄不更新
function varargout = test(varargin)
% --- Outputs from this function are returned to the command line.
function varargout = test_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
varargout{2} = handles.test;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
handles.test = 'ok';
% Update handles structure
guidata(hObject, handles);
而且我只要一執行GUI時,我收到此錯誤信息:
我發現一個similar關於MATLAB新聞組的問題,但我沒有找到解決方案(我讀了所有guidata的文檔,就像建議的那樣)。
我的問題是,我在一個GUIDE的函數內的「句柄」結構中記錄了一個信息,我無法在另一個函數中檢索到這個信息。
I tried取消註釋test_OpeningFcn
函數中的UIWAIT調用,試圖等待用戶關閉窗口。
% --- Executes just before test is made visible.
function test_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for test
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes test wait for user response (see UIRESUME)
uiwait(handles.figure1);
當我點擊按鈕,然後嘗試採取句柄變量。但它也不起作用,並且fails也有類似的錯誤信息。
任何幫助將受到歡迎。 感謝您的關注。
感謝您的關注,但它沒有奏效,@copiancestral :( – jhonatanoliveira 2012-08-08 01:24:03