How to add extra arguments to callback functions in App Designer?

21 views (last 30 days)
I want to be able to pass parameters or arguments into the callback function, but do not know how to do this or if it is even possible. Currently, this is how I create a callback function within the code view of App Designer. {test.ValueChangedFcn = createCallbackFcn(app,@testChange,true);} From there, I would create {function testChange(app,event) %%code end}
What if i need {function testChange(app,event,arg1,arg2)}?
Does anybody know how I can do this or if this is possible?

Answers (1)

Mudambi Srivatsa
Mudambi Srivatsa on 26 Jun 2017
Adding extra arguments into a callback function is not possible in App Designer. However, you can share the data to callback functions as application state since "app" is accessible.
For more information, refer to the following links:
http://www.mathworks.com/help/matlab/creating_guis/differences-between-app-designer-and-guide.html#buv81ly-1
http://www.mathworks.com/help/matlab/creating_guis/share-data-across-callbacks-in-app-designer.html#busp3ol-13

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!