Resolution of Function Calls for Code Generation - MATLAB & Simulink (original) (raw)

Main Content

From a MATLAB® function, you can call local functions, supported toolbox functions, and other MATLAB functions. MATLAB resolves function names for code generation as follows:

This image shows the flowchart for how MATLAB resolves function names for code generation.

Key Points About Resolving Function Calls

The diagram illustrates key points about how MATLAB resolves function calls for code generation:

Compile Path Search Order

During code generation, function calls are resolved on two paths:

  1. Code generation path
    MATLAB searches this path first during code generation. The code generation path contains the toolbox functions supported for code generation.
  2. MATLAB path
    If the function is not on the code generation path, MATLAB searches this path.

MATLAB applies the same dispatcher rules when searching each path (see Function Precedence Order).

When to Use the Code Generation Path

Use the code generation path to override a MATLAB function with a customized version. A file on the code generation path shadows a file of the same name on the MATLAB path.

For more information on how to add additional folders to the code generation path, see Paths and File Infrastructure Setup.