How to link Matlab GUI push button to an external button on arduino?

Hello, I wanna trigger the webcam in matlab through pressing an external push button on arduino. Is this possible, if it is can you show me a part of program?

thank you.

One way to do it would be to read the Arduino push button input and when you determine that it has become pressed send a message to MatLab via the serial interface.

buttonState = digitalRead(buttonPin);
if (buttonState != prevButtonState && buttonState == LOW)
{
    Serial.println("ON");
}
prevButtonState = buttonState;