hi!
I've been trying to send the values generated in the arduino to matlab for plotting. I got this code in the following linkhttp://allaboutee.com/2011/07/04/how-to-send-data-from-the-arduino-to-matlab/
This is the code for the arduino
int i=0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(i);
i++;
}
and this is the code for matlab
clear all
clc
arduino=serial('COM4','BaudRate',9600);
fopen(arduino);
x=linspace(1,100);
for i=1:length(x)
y(i)=fscanf(arduino,'%d');
end
fclose(arduino);
disp('making plot..')
plot(x,y);
I'm facing an error when I try to run the code for matlab. I've attached the error message. I know this might not be very appropriate place to ask question on matlab. But I believe there will be someone who can help me out who has dealt with arduino and matlab serial communication.