Linking callback functions to a main GUI
显示 更早的评论
i have created a gui using m file and not the fig file and guide. how can i link the callback functions in the main program? when i tried adding the callback in the main file it gave an error
functions cannot be declared as a script.
- after this i separated the callback functions in different m files . the problem is how m i supposed to link the callback functions with the main program.
if i need to declare it in the main program then whT is the syntax for declaring a callback function in a program for GUI
回答(1 个)
Walter Roberson
2012-11-22
0 个投票
You do not need to put the functions into different .m files if you just make your main GUI file a function.
But once they are in separate .m files that are each named with the function name that is inside each, then all that is necessary to "link" the two is for the functions to be on the MATLAB path that is in use by the main file. If you do not change directories within the main file then probably having the functions in the same directory as the main file is enough. MATLAB will go looking for each function at the time the function is first called or referenced as a function handle.
类别
在 帮助中心 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!