MATLAB Function Block Basics

Integrate MATLAB® functions into Simulink® models

Use MATLAB Function block to implement MATLAB functions to Simulink models to deploy code and embed code in processors. Using MATLAB Function block, you can generate readable, efficient, and compact C/C++ code for deployment to desktop and embedded applications.

Blocks

MATLAB FunctionInclude MATLAB code in models that generate embeddable C code

Objects

MATLABFunctionConfigurationConfigure MATLAB Function block properties programmatically

Simulink Configuration Parameters

Topics

Implementing MATLAB Functions Using Blocks

Add MATLAB functions to Simulink models.

Create Custom Functionality Using MATLAB Function Block

Follow workflow for integrating a MATLAB Function block in a Simulink model.

Resolve Signal Objects for Output Data

Manage implicit signal resolution at various levels of the model hierarchy.

Create Custom Block Libraries

Create custom block libraries with MATLAB Function blocks.

Integration Considerations for MATLAB Function Blocks

Integrate a MATLAB Function block into your Simulink model.

Track Object Using MATLAB Code

Integrate MATLAB code into a Simulink model that estimates the position of an object moving in a two-dimensional space.

Filter Audio Signal Using MATLAB Code

Integrate MATLAB code into a Simulink model for a signal processing application.

Integrate C Code Using the MATLAB Function Block

Use MATLAB Function block to call external C code and how to control enumeration and bus typedefs.

Troubleshooting

Debugging a MATLAB Function Block

Debug a MATLAB Function block function during simulation and check for data range violations.

Prevent Algebraic Loop Errors in MATLAB Function and Stateflow Blocks

Adhere to restrictions for using MATLAB Function blocks, Stateflow® charts, and Truth Tables in feedback loops.