Hello,
I have some problem to understand the error message. It's actually code on matlab, but it has relation with arduino.
Here is my code:
function matlab_arduino(nm) %function decleration
close all;
clc;
y=zeros(1,1000);
delete(instrfind({'Port'},{'COM41'}));
ps= arduino('COM41'); %connect to the arduino
warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
cm=1;
grid on;
hold on;
while (cm<=nm)
ylim([0 5]);
xlim([cm-20 cm+5]);
y(cm)=ps.analogRead(0)* 0.48828125; %read the analog signal from arduino
plot(cm,y(cm),'X-r'); %plot the wave of the analog signal
drawnow
cm=cm+1;
end
delete(ps);
clear all;
end
I have problem on while(cm<=nm)
If there's any input for this, please kindly share it with me , thank you