Linking callback functions to a main GUI
11 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 22 Nov 2012
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.
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!