Varargout won't work with my GUI when similar GUI works fine with same formatting.
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to get output from a GUIDE GUI by passing back to the calling data analysis script and when I press the finish button in my gui it completes uiresume(handles.object) which was previously set by uiwait(handles.object).
Then it gets to the following section.
function varargout = GUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
disp(nargout)
if handles.done==1
handles.output={handles.value1,handles.value2};
% Get default command line output from handles structure
varargout = handles.output;
delete(hObject)
end
It then gives me the error:
Too many output arguments.
despite calling with this
[output1,output2]=GUI(input1(:,m),input2(:,m));
output1 and output2 are both non-array doubles and the
The above functions, in the end, also don't close the GUI despite calling for delete(hObject) and when I use the actual exit window button it causes the error
Error while evaluating CloseRequestFcn
and it tells me
??? Error using ==> plot
Error in color/linetype argument
as part of the same CloseRequestFcn error when I never even use color/linetype arguments in this GUI.
Then because of the CloseRequestFcn error I'm never able to reinitialize the same GUI until after I close out of the Matlab session which if I click the exit button cause Matlab to enter an infinite loop preventing it from closing and forcing me to use Ctr+Alt+Delete to exit.
What is most infuriating about this is that I have used the same format for opening and closing a similar GUI from a similar script that fully functions. Actually the previous GUI was copied and pasted and altered to fit the requirements. The process of me passing variables back is exact same to, the only difference is that I was passing two arrays in the original GUI instead of two non-array doubles. However the "Done" button and its callback function have not changed nor did the OutputFcn
The "Done" button callback is as follows
% --- Executes on button press in complete.
function complete_Callback(hObject, eventdata, handles)
% hObject handle to complete (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.done=1;
handles=guidata(hObject);
guidata(hObject,handles);
uiresume(handles.object);
What is happening? How do I fix it?
I thank anyone and everyone who can help in advance.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!