am using this code for matlab
arduino=serial('COM7','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);
code for Arduino
{
analogInput = i+1;
value = 0;
pinMode(analogInput, INPUT);
}
// begin sending over serial port
Serial.begin(9600);
}
void loop()
{
// read the value on analog input
for(int i=0;i<6;i++)
{
value = analogRead(analogInput);
}
// print out value over the serial port
for(int i=0;i<6;i++)
{
Serial.println(10000 + i + 1); //prefix
Serial.println(value);
Serial.println(10010); //end signal
}
// wait for a bit to not overload the port
delay(1000);
but i could not plot graph in matlab.
any any suggestion