GUI Has Error Although It Worked Fine Before and I Did Not Change Code
Mostrar comentarios más antiguos
Hi, when I first created my GUI everything worked fine. Then I closed Matlab, reopened my GUI and ran it and now it won't run because it has errors in its internal function when it worked fine before. I did not change anything in my code so I don't understand why it's no longer working when I reopen Matlab. I attached my code below. This is the error message I receive:
Undefined function or variable 'writePWMDutyCycle'.
Error in code1>pushbutton1_Callback (line 98)
writePWMDutyCycle(a,'D10',0);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in code1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)code1('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
This is my first time posting so please let me know if I need to clarify anything or change my formatting.
6 comentarios
Walter Roberson
el 1 de Sept. de 2017
Somehow, the Arduino support package is no longer on your MATLAB path. You might need to reinstall the Arduino support package.
Walter Roberson
el 1 de Sept. de 2017
I do not see anything suspicious in the code.
Before the problem occurs, what shows up for
which -all writePWMDutyCycle
and what shows up when the problem occurs?
Before the problem starts, save a copy of the result of path(), and then when the problem occurs, have another look at path() and compare.
OCDER
el 1 de Sept. de 2017
Try adding the path to writeDWMDutyCycle inside the code1_OpeningFcn block.
function code1_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
addpath( folder ); % Here, Add the folder path to writeDWMDutyCycle
guidata(hObject, handles);
Walter Roberson
el 2 de Sept. de 2017
Editada: Walter Roberson
el 2 de Sept. de 2017
To confirm: after the problem occurs, does
C:\ProgramData\MATLAB\SupportPackages\R2017a\toolbox\matlab\hardware\supportpackages\arduinoio\@arduino\arduino.m
still exist?
If you execute the command
clear all
and run again, does it start working? How about if you
rehash toolboxcache
then does that start it working?
Another thing to try is
fclose('all')
when the problem has occurred.
It is certainly an odd situation.
Respuestas (0)
Categorías
Más información sobre Arduino Hardware 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!