I'm assuming, that you are sending the angle value as a 1-byte value, so no ASCII encoded numbers. This is how the code in your question works, so it should be right.
You don't have to convert anything here. The
Serial.read() function already returns an integer value and you are saving it to an integer variable. But in your code you only care for 2 different states (100 and 101), instead of the actual angle value. Now you only have to replace your if-statements and write this value directly to the servo:
You doesn't seem as you know how serial communication (to be exactly USART) functions. So I will explain further:
The data, that is send over serial is just a stream of bytes. All content, that get transmitted are converted to a stream of bytes. Every byte has a numerical value. For example a byte with the bit-content
00100000 has a numerical value of
32. But at some point in history it was necessary to send text with a byte stream. So someone invented ASCII, which assigns a character or control command to every numerical value from 0 to 127. So if you send a byte with the numerical value of
32, you could mean the actual numerical value
32, or you could mean the ASCII equivalent to
32, which is the space character. This is just an interpretation of the byte data, that flows through the serial interface.
So you have to investigate, in which kind you are encoding the angle value. If you use
fwrite() in your Matlab code, you are most likely sending the byte value, which you can simply use as described above. If you use
fprintf(), you are sending the angle value as an ASCII encoded string. The value
32 from above would then occupy 2 bytes with the characters
2, which correspond to the byte values of
50. In this case you should add a delimiter character at the end in
fprintf() (for example the newline character "\n") and use
Serial.parseInt() to get the angle value from the string.
You can read more of this in many tutorials about Serial communication that you can find in the internet. Also refer to the example, that come with the Arduino IDE.