Callback functions: more than 2 input arguments

Hi, attempting my first GUI and am wondering if it is possible to add extra input arguments into a callback function.
Typically you just have hObject,eventdata. I want to add 3 variables from my workspace, how do I do that from the command: set(buttonsY,'SelectionChangeFcn',@yvar_Callback)
Thanks in advance, fiona

1 个评论

There is no master workspace like there is with a simple script. Each function has its own private workspace. You can make variables global with the global keyword and then every function that declares that variable global will be able to see it - no passing via the argument list is needed. They would rather that you use getappdata() and setappdata() though.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

提问:

2013-3-28

Community Treasure Hunt

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

Start Hunting!

Translated by