Why am I always getting 48 with serial communication?
Why am I always getting 48 with serial communication?


Your Arduino sketch (snippet) is reading a byte and writing the value, not the character. The value 48 in ASCII is the character '0'. 

The below loop() function will echo all the characters received. 

void loop()
{
  while (Serial.available()) {
     char c = Serial.read();
     Serial.println(c);
  }
}


This could be a good starting point when debugging what is actually written from MATLAB.