Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

%#function

Pragma to help MATLAB Compiler locate functions called through feval, eval, Handle Graphics callback, or objects loaded from MAT-files

Synopsis

%#function function1 [function2 ... functionN]

%#function object_constructor

Description

The %#function pragma informs MATLAB® Compiler™ that the specified function(s) will be called through an feval, eval,Handle Graphics® callback, or objects loaded from MAT-files.

Use the %#function pragma in standalone applications to inform MATLAB Compiler that the specified function(s) should be included in the compilation, whether or not MATLAB Compiler's dependency analysis detects the function(s). It is also possible to include objects by specifying the object constructor.

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, MATLAB Compiler 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.

Example 3

function foo 
   %#function ClassificationSVM 
    
      load('svm-classifier.mat'); 
      num_dimensions = size(svm_model.PredictorNames, 2); 
    
    end %function foo 

In this example, an object from the class ClassificationSVM is loaded from a MAT-file. For more information, see MATLAB Data Files in Compiled Applications (MATLAB Compiler).

Introduced before R2006a

Was this topic helpful?