Disabling a Button after pressed - GUI
이전 댓글 표시
Im getting this error message for a GUI
Struct contents reference from a non-struct array object.
I have the student use version.
Error in JOSHSPOKER>pushbutton1_Callback (line 84)
set(handles.pushbutton1,'enable','off')
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in JOSHSPOKER (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)JOSHSPOKER('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
This is my code:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%DISABLE!!!
set(handles.pushbutton1,'enable','off')
set(handles.pushbutton1,'visible','off')
[MyCard1, MyCard2, TheirCard1, TheirCard2] = shuffle
답변 (1개)
Walter Roberson
2016년 3월 18일
Somehow, your handles structure is not a handles structure. Either:
- it was never set up properly (e.g., you did not use GUIDE and you did not create it yourself); or
- you have used it before it is set up properly (but it should already have been done by the time any callback can be invoked); or
- it has been corrupted, such as you somewhere call
guidata(hObject,handles)
after handles had been set to a non-structure.
댓글 수: 8
Joshua Wojciechowski
2016년 3월 20일
Joshua Wojciechowski
2016년 3월 20일
Walter Roberson
2016년 3월 20일
We need to see your complete .m file that was written by GUIDE.
Joshua Wojciechowski
2016년 3월 20일
편집: Walter Roberson
2016년 3월 20일
Walter Roberson
2016년 3월 20일
I guess I will need the .fig as well.
Joshua Wojciechowski
2016년 3월 20일
Joshua Wojciechowski
2016년 3월 20일
Joshua Wojciechowski
2016년 3월 20일
카테고리
도움말 센터 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!