Main Content

Import Custom C/C++ Code Using the Simulink Code Importer

Create Simulink® libraries from your custom C/C++ code with the Simulink Code Importer tool

Use the Simulink Code Importer tool to build a Simulink library from your custom C/C++ code library. The Simulink Code Importer brings custom code into a Simulink library of C Caller blocks as callable functions, after analyzing the custom code for functions and their dependencies, including global variables and types used by the functions.

To use the Simulink Code Importer, go to the Modeling tab on the Simulink toolstrip. From Design, choose Code Importer. A series of screens then leads you through the process of creating a Simulink library from your custom code.

Alternatively, you can create an object of the Simulink.CodeImporter class and run the Code Importer tool using a command-line interface.

Classes

Simulink.CodeImporterImport custom C/C++ code into Simulink
Simulink.CodeImporter.CustomCodeSpecify custom code settings for Simulink.CodeImporter and sltest.CodeImporter classes
Simulink.CodeImporter.OptionsSpecify additional import options for Simulink.CodeImporter and sltest.CodeImporter classes
Simulink.CodeImporter.ParseInfoInformation about parsed custom code
Simulink.CodeImporter.FunctionAccess and configure detailed information about parsed custom code functions
Simulink.CodeImporter.SimulinkPortSpecificationConfigure port specification for imported custom code

Blocks

C CallerIntegrate C code in Simulink

Topics

Import Custom Code Using the Simulink Code Importer Wizard

Use the Simulink Code Importer to create a library of C Caller blocks from your custom C/C++ code.