Send data from Arduino to Matlab

Hi there,
I am new to Arduino and I have got a problem I am working on for 2 days...
I measure voltage with my Arduino Mega board and I want to send it to Matlab to visualize it and so on.
Here is my Arduino code:

const float sensorVoltage=A0;
void setup() {
  Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}
void loop() {
  float inputVoltage2=analogRead(sensorVoltage);  
  float voltage2=5*inputVoltage2/1024; 
  Serial.println(voltage2); 
}

The Arduino code works so far. It shows me the measured voltage. The problem is the interaction with Matlab.
Here is my Matlab code:

delete(instrfind({'Port'},{'COM5'}));
s = serial('COM5', 'BaudRate', 9600);
fopen(s);
a=fscanf(s,'%f');
disp(a)

Matlab stores my variable a as a 1x7char in the workspace. But why?? I never defined anything as a character or as an array.
That's why I get a warning: Warning: Unsuccessful read: Matching failure in format..
disp(a) prints: ¦H0.29
0,29 would be the correct value, but why are there these signs in front of the value?...
Please help me

regards

Sounds like a Matlab problem to me.
This isn't the place to ask Matlab problems.

const float sensorVoltage=A0;

So you seriously plan to use pin 3.14159 sometime in the future? Pin numbers are INTEGER values.
After you open the serial port, which resets the Arduino, how long do you give it to reset before you expect it up, running, and sending serial data?

"Pin numbers are INTEGER values."
Pin numbers should be BYTE values, none are over 255.

CrossRoads:
"Pin numbers are INTEGER values."
Pin numbers should be BYTE values, none are over 255.

I know, but if I say that pin numbers need to be integral values, very few people seem to know what I'm talking about.

try fgetl instead

Hello, see my code for Matlab (I part) , there you will find an excellent example, for data transmission on the Arduino COM-port!

Better to send data using the following command:

mypi = raspi(raspi.connecting.ipadress,...
raspi.connecting.username,...
raspi.connecting.password);

rs232 = serialdev(mypi,'/dev/ttyAMA0',...
raspi.interfaces.rs232.baudRate,...
raspi.interfaces.rs232.dataBits,...
raspi.interfaces.rs232.parity,...
raspi.interfaces.rs232.stopBits);

t = [36, 1, 0, 0, p + q/2, 0, 0, p - q/2, 0, 35] % DATA

write(rs232, t, 'uint8')

Precision may be 'uint8' (default) | 'uint16' | 'uint32' | 'int8' | 'int16' | 'int32' | 'char' | 'single' | 'double'

The second method is to use Simulink (II part of video), which has a customizable block COM-port for Arduino