Main Content

Integrate C/C++ Code Using Code Importers

Use Simulink® Code Importer, C Caller block, or C Function block to import your C code

Choose the appropriate importer based on your requirements.

  • If you have one simple C function and its Simulink implementation does not require states, use C Caller block.

  • If you want to integrate multiple C functions, use C Function block when its Simulink implementation:

    • Requires the function to be called conditionally

    • Does not require states

    • Requires discrete states retained for a single time step

    • Requires preprocessing and postprocessing of data

  • If you want to create a Simulink library of C Caller blocks from your C/C++ code using a simple wizard, use the Simulink Code Importer.