Error while evaluating UIControl Callback.
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Samuel Crofts
am 28 Dez. 2018
Kommentiert: Samuel Crofts
am 28 Dez. 2018
Hi there, my push button code does not work, it is almost identical to the code of a different pushbutton which is just to open a different GUI.
% --- 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)
run game.m
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run howtoplay.m
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)attempt2('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
Pushbutton2 works, pushbutton1 does not.
4 Kommentare
Akzeptierte Antwort
Stephen23
am 28 Dez. 2018
Bearbeitet: Stephen23
am 28 Dez. 2018
As its help clearly explains, run will run a script, but it will not run a function (e.g. a GUI main file).
PS: Avoid GUIDE. Writing your own code is better:
2 Kommentare
Stephen23
am 28 Dez. 2018
"Why does pushbutton 2 run correctly?"
Because the code inside does not throw an error. Presumably howtoplay.m is a script on the MATLAB search path.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!