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

21 次查看(过去 30 天)
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?

回答(1 个)

Mudambi Srivatsa
Mudambi Srivatsa 2017-6-26
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

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by