Start/Stopp in one Button

4 Ansichten (letzte 30 Tage)
Alicia Wüst
Alicia Wüst am 5 Mai 2021
Bearbeitet: Fangjun Jiang am 5 Mai 2021
Hi everybody,
I want to create a 'Start'- button that opens the connected webcam and displays the video in an UI-Axes. If i clicked 'start', the button should change to 'stop' so that I can press it again to stop the camera. So far I've got 2 different buttons programmed.
Can anyone help me to connect these two buttons?
Thanks a lot for your help!
Best regards.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 5 Mai 2021
Bearbeitet: Fangjun Jiang am 5 Mai 2021
For fun, one-liner
uibutton('Text','Start','ButtonPushedFcn','set(gcbo,''text'',setdiff(["Start","Stop"],get(gcbo,''text'')))')
The general approach is, in your callback function of the button, get and set the text of the button.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by