MATLAB GUIDE를 사용하여 GUI를 만들었습니다. GUI에서 값을 반환하려고합니다. 여기에 코드의 관련 부분 (전체 코드는 here를 찾을 수 있습니다)입니다 : 내가 찾은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를 실행, 나는이 오류 메시지가 즉시 MATLAB 뉴스 그룹에 similar 질문이 있지만 해결책을 찾지 못했습니다. (제안 된 것처럼 모든 guidata의 문서를 읽었습니다).
내 문제는 하나의 GUIDE 함수 내에서 "handles"구조체에 정보를 기록했기 때문에 다른 함수에서이 정보를 검색 할 수 없다는 것입니다.
triedtest_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