Automatic Callback creation for UI Button

3 views (last 30 days)
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.

Accepted Answer

Ameer Hamza
Ameer Hamza on 19 Jun 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 Comments
Ameer Hamza
Ameer Hamza on 22 Jun 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 on 24 Jun 2020
You are correct. It worked! Thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!