Hi, I am sending data from Arduino Uno to MATLAB. Below is my Arduino and MATLAB code.
Arduino Code:
const float sensorVoltage=A0;
void setup() {
Serial.begin(9600);
}
void loop() {
float inputVoltage2=analogRead(sensorVoltage);
float voltage2=5*inputVoltage2/1024;
Serial.println(voltage2);
}
MATLAB code:
delete(instrfind({'Port'},{'COM7'}));
s = serial('COM7', 'BaudRate', 9600);
fopen(s);
a=fgetl(s);
disp(a)
fclose(s);
However, the value received has a weird symbol in front of it as shown below:

Anyone can help me solve this problem? Thank you very much
Arduino Code:
const float sensorVoltage=A0;
void setup() {
Serial.begin(9600);
}
void loop() {
float inputVoltage2=analogRead(sensorVoltage);
float voltage2=5*inputVoltage2/1024;
Serial.println(voltage2);
}
MATLAB code:
delete(instrfind({'Port'},{'COM7'}));
s = serial('COM7', 'BaudRate', 9600);
fopen(s);
a=fgetl(s);
disp(a)
fclose(s);
However, the value received has a weird symbol in front of it as shown below:

Anyone can help me solve this problem? Thank you very much