Hi,
From my understanding there are few cases leading the issue.
- Pin 19 is not a available Digital Pin/GPIO
Read logical value from GPIO input pin - MATLAB readDigitalPin (mathworks.com) - This documentation should help you in finding the available pins.
2. The sensor may be too sensive to the lighting conditions. You can check the Pin with a Digital multimeter.
3. You can cross check the readDigitalPin with a switch and see if the value changes.