Disabling a Button after pressed - GUI
Mostrar comentarios más antiguos
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
Respuestas (1)
Walter Roberson
el 18 de Mzo. de 2016
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 comentarios
Joshua Wojciechowski
el 20 de Mzo. de 2016
Joshua Wojciechowski
el 20 de Mzo. de 2016
Walter Roberson
el 20 de Mzo. de 2016
We need to see your complete .m file that was written by GUIDE.
Joshua Wojciechowski
el 20 de Mzo. de 2016
Editada: Walter Roberson
el 20 de Mzo. de 2016
Walter Roberson
el 20 de Mzo. de 2016
I guess I will need the .fig as well.
Joshua Wojciechowski
el 20 de Mzo. de 2016
Joshua Wojciechowski
el 20 de Mzo. de 2016
Joshua Wojciechowski
el 20 de Mzo. de 2016
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!