MATLAB Compiler Previous page   Next Page

Fixing Callback Problems: Missing Functions

When the Compiler creates a stand-alone application, it compiles the M-file(s) you specify on the command line and, in addition, it compiles any other M-files that your M-file(s) calls. The Compiler uses a dependency analysis, which determines all the functions on which the supplied M-files, MEX-files, and P-files depend. The dependency analysis may not locate a function if the only place the function is called in your M-file is a call to the function either

The Compiler does not look in these text strings for the names of functions to compile.

Symptom

Your application runs, but an interactive user interface element, such as a push button, does not work. The compiled application issues this error message.

Workaround

There are several ways to eliminate this error.

Specifying Callbacks as Strings.   Create a list of all the functions that are specified only in callback strings and pass these functions using separate %#function pragma statements. (See Finding Missing Functions in an M-File for suggestions about finding functions in callback strings.) This overrides the Compiler's dependency analysis and instructs it to explicitly include the functions listed in the %#function pragmas.

For example, the call to the change_colormap function in the sample application, my_test, illustrates this problem. To make sure the Compiler processes the change_colormap M-file, list the function name in the %#function pragma.

Specifying Callbacks with Function Handles.   To specify the callbacks with function handles, use the same code as in the example above and replace the last line with

For more information on specifying the value of a callback, see Specifying the Value of Callback Function Properties in the MATLAB Programming documentation.

Using the -a Option.   Instead of using the %#function pragma, you can specify the name of the missing M-file on the Compiler command line using the -a option.


Previous page  Stand-Alone Applications Finding Missing Functions in an M-File Next page

© 1994-2005 The MathWorks, Inc.