More MATLAB Trouble

servo[0], pwm[0], pressure[0] = '\0';

Tell me what you think this is doing?

int index

The variable index is a local variable, with no initial value. So, it contains some random garbage.

       switch (index){

So, you want to switch based on random garbage?

   if(aChar == ',')
   {
<snip>
        if (aChar == '\n')
       {
         x = 1;
       }
   }

So, under what circumstances is the value in aChar going to morph from a command to a carriage return?