Encapsulating the Interface to External Code

Use the coder.ExternalDependency class to encapsulate the interface between external code and MATLAB® code intended for code generation. With the encapsulation, you can separate the details of the interface from your MATLAB code. The methods of coder.ExternalDependency:

  • specify the location of external files

  • update build information

  • define the programming interface for external functions

In your MATLAB code, you can call the external code without providing build information.

The workflow is:

  1. Write a class definition file for a class that derives from coder.ExternalDependency.

  2. Store the class definition file in a folder on the MATLAB path.

  3. In your MATLAB code, use a method of the class to call an external function.

  4. Generate code from your MATLAB code.

See Also

Related Examples

More About

Was this topic helpful?