Linking callback functions to a main GUI

12 visualizaciones (últimos 30 días)
Sandra Joseph
Sandra Joseph el 22 de Nov. de 2012
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

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Nov. de 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.

Categorías

Más información sobre Environment and Settings 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