This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Implement Algorithms Using C/C++ Code

Implement a new algorithm using C/C++ code

Implement C/C++ code in Simulink® using the blocks you develop. You can use these methods to implement your code:

  • C Caller Block — Integrates C code into Simulink by importing your C functions.

  • S-Function — Uses special syntax called S-function API to communicate with the Simulink engine. They allow you to create continuous, discrete, and hybrid systems.

  • S-Function Builder — Integrates C/C++ code by building an S-function from your code with the specifications you supply. The S-function builder also serves as a wrapper for the S-functions generated in your models.

  • Legacy Code Tool — Integrates C/C++ functions, such as lookup tables, and general functions and interfaces into Simulink models.

Featured Examples