I am trying to store values from serial monitor of Arduino to a vector in MATLAB.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
if true
% code
end
function pushbutton1_Callback(hObject, eventdata, handles)
delete(instrfind)
theta=zeros(1,100000);
arduin=serial('COM3','BaudRate',9600); % create serial communication object on port COM18
fopen(arduin); % initiate arduino communication
CM(1)=0;
time(1)=0;
tic;
while (toc<=60) % stop after 60 secs
for i=1:100
theta(i)=fscanf(arduin,'%f');
end
end
fclose(arduin); % end communication with arduino
delete(arduin);
guidata(hObject, handles); It generates an error: Error in fyp>pushbutton1_Callback (line 90) theta(i)=fscanf(arduin,'%f');
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in fyp (line 42) gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)fyp('pushbutton1_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Arduino Hardware 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!