Filter löschen
Filter löschen

Associate a button in GUI with a key

1 Ansicht (letzte 30 Tage)
Amir Mohammad Alizadeh
Amir Mohammad Alizadeh am 3 Jan. 2023
Kommentiert: Walter Roberson am 3 Jan. 2023
I have a GUI that executes a function that remains in the loop until "Esc" key is pressed or certain amount of time is passed. However, I want to do it using a push button in my GUI is pressed. I am sure there is a simple solution for it.
Thanks!
  7 Kommentare
Rik
Rik am 3 Jan. 2023
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. You should probably be able to modify the examples from that threat to suit your needs.
Otherwise, post what you have tried and I'll see what I can do to modify it.
Walter Roberson
Walter Roberson am 3 Jan. 2023
There is one possibility that does not involve editing the function itself:
The function just might possibly have been implemented in terms of the function checking to see if a particular stop indication variable has been set, with a key press callback having been established that sets the flag.
If that just happens to be the case, then you could remove the key press callback and add in a button press callback that set the flag.
You would still need to edit something but it would not, in this limited case, be the code loop itself.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by