Main Content



Select C or C++ language to compile and parse custom code integrated in Simulink® blocks. This option affects the C Function, C Caller, MATLAB Function, and MATLAB System blocks, and Stateflow® charts. If Import Custom Code is checked, available custom code variables and functions are parsed.

Category: Simulation Target


Default: C


Compiles custom code using rules of C.


Compiles custom code using rules of C++.

Select the C++ option to:

  • Generate MATLAB Function block or Stateflow chart MEX code as C++ files and compile custom code using C++. For MATLAB Function and MATLAB System blocks, if you add C++ code to buildInfo using coder.updateBuildInfo or coder.ExternalDependency, set Language to C++.

  • Simulate a MATLAB System block through code generation and compilation using C++.

Before you build a system, configure Simulink to use a compiler system using mex -setup.

Command-Line Information

Parameter: SimTargetLang
Value: 'C' | 'C++'
Default: 'C'

Recommended Settings

TraceabilityNo impact
EfficiencyNo impact
Safety precautionOn

Related Topics