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

10 visualizaciones (últimos 30 días)
Dorothy Yuan
Dorothy Yuan el 21 de Jun. de 2017
Respondida: Mudambi Srivatsa el 26 de Jun. de 2017
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?

Respuestas (1)

Mudambi Srivatsa
Mudambi Srivatsa el 26 de Jun. de 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

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by