I am trying to store values from serial monitor of Arduino to a vector in MATLAB.

1 vue (au cours des 30 derniers jours)
Mahnoor Irshad
Mahnoor Irshad le 8 Nov 2017
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

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by