i am trying to serially communicate arduino and matlab. i have to receive signals from matlab. based on the received signals arduino has to run the motors using the motor shield. the receiving led is glowing whenever the matlab sends the signal but i am unable to read those signals in the arduino. i am attaching my arduino code to read the siganls. i am also including the matlab code to transfer the signals.
Have a look at the examples in Serial Input Basics for simple reliable ways to receive data. There is also a parse example.
You should also separate the code for receiving data from the code for controlling the motors so that the different parts can be tested on their own. The receiving code should store the data in variables and the motor code should do its stuff based on whatever happens to be in the variables.