count a loop when button is pushed

hi,
i have a button with which i start a function. in the function there should be a for loop that counts up every time the button is clicked. what is the best way to solve this?
Best regards

Antworten (2)

Mike
Mike am 12 Apr. 2021

1 Stimme

All controls come with a "UserData" field. I would use that, In "startupFcn" initialize to zero
app.Button.UserData = 0
Then in the button pushed function
app.Button.UserData = app.Button.UserData + 1;
Image Analyst
Image Analyst am 12 Apr. 2021

0 Stimmen

See attached GUI. When you press the Go button, it counts up and put the result into a text label on the GUI. When you press the Stop button, it stops.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 12 Apr. 2021

Beantwortet:

am 12 Apr. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by