Global Variable (Value Read Serially from Matlab) Becomes 0

Opening the serial port can reset the Arduino.