%#function

Pragma to help MATLAB Compiler SDK locate functions called through feval, eval, or graphics callback

Synopsis

%#function function1 [function2 ... functionN]

%#function object_constructor

Description

The %#function pragma informs the compiler that the specified function(s) will be called through an feval, eval, or graphics callback.

Without this pragma, the product's dependency analysis will not be able to locate and compile all MATLAB® files used in your application. This pragma adds the top-level function as well as all the local functions in the file to the compilation.

Examples

Example 1

 function foo 
   %#function bar 
       
      feval('bar'); 
    
   end %function foo 

By implementing this example, the MATLAB Compiler SDK™ product is notified that function bar will be included in the compilation and is called through feval.

Example 2

function foo 
   %#function bar foobar 
    
      feval('bar'); 
      feval('foobar'); 
    
   end %function foo 

In this example, multiple functions (bar and foobar) are included in the compilation and are called through feval.

Was this topic helpful?