Automatic Callback creation for UI Button

1 vue (au cours des 30 derniers jours)
Therry Beauge
Therry Beauge le 18 Juin 2020
Commenté : Therry Beauge le 24 Juin 2020
Hello there.I have a loop that automatically creates UI buttons based on a file that is read and the amount of instances in the file. I would like to now access those callbacks (or essentially make them) while in the loop. How can I go about this?
I am using MATLAB 202a.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 19 Juin 2020
You can use the ButtonPushedFcn property of the uibutton to assign it a callback. For example
btn = uibuttin();
btn.ButtonPushedFcn = @function_handle_name
  5 commentaires
Ameer Hamza
Ameer Hamza le 22 Juin 2020
Can you create a small app which just creates a button and assign a callback function to it, similar to your current app? It will make it easy to see the issue happening in your code.
Therry Beauge
Therry Beauge le 24 Juin 2020
You are correct. It worked! Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by