Linking callback functions to a main GUI

조회 수: 16 (최근 30일)
Sandra Joseph
Sandra Joseph 2012년 11월 22일
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
Walter Roberson 2012년 11월 22일
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.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by