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

조회 수: 21 (최근 30일)
Dorothy Yuan
Dorothy Yuan 2017년 6월 21일
답변: Mudambi Srivatsa 2017년 6월 26일
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