Main Content

File packaging format

Method of file packaging for generated code files

Model Configuration Pane: Code Generation / Code Placement

Description

Specify whether code generation modularizes the code components into many files or compacts the generated code into a few files. You can specify a different file packaging format for each referenced model.

Settings

Modular (default) | Compact (with separate data file) | Compact

Default: Modular

Modular

  • Outputs model_data.c, model_private.h, and model_types.h, in addition to generating model.c and model.h. For the contents of these files, see the table in Generated Code Modules.

  • Supports generating separate source files for subsystems. For more information on generating code for subsystems, see Generate Subsystem Code as Separate Function and Files.

  • If you specify Shared code placement as Auto on the Code Generation > Interface pane of the Configuration Parameter dialog box, some utility files are in the build directory. If you specify Shared code placement as Shared location, separate files are generated for utility code in a shared location.

Compact (with separate data file)
  • Conditionally outputs model_data.c, in addition to generating model.c and model.h.

  • If you specify Shared code placement as Auto on the Code Generation > Interface pane of the Configuration Parameter dialog box, utility algorithms are defined in model.c.

  • If you specify Shared code placement as Auto, and your model contains at least one of these blocks, separate files are generated for utility code in a shared location.

    • Model blocks

    • Simulink Function blocks

    • Function Caller blocks

    • Calls to Simulink Function blocks from Stateflow® or MATLAB Function blocks

    • Stateflow graphical functions when you select the Export Chart Level Functions parameter

  • If you specify Shared code placement as Shared location, separate files are generated for utility code in a shared location.

  • Does not support separate source files for subsystems.

  • Does not support models with noninlined S-functions.

Compact
  • The contents of model_data.c are in model.c.

  • The contents of model_private.h and model_types.h are in model.h or model.c.

  • If you specify Shared code placement as Auto on the Code Generation > Interface pane of the Configuration Parameter dialog box, utility algorithms are defined in model.c.

  • If you specify Shared code placement as Auto, and your model contains at least one of these blocks, separate files are generated for utility code in a shared location.

    • Model blocks

    • Simulink Function blocks

    • Function Caller blocks

    • Calls to Simulink Function blocks from Stateflow or MATLAB Function blocks

    • Stateflow graphical functions when you select the Export Chart Level Functions parameter

  • If you specify Shared code placement as Shared location, separate files are generated for utility code in a shared location.

  • Does not support separate source files for subsystems.

  • Does not support models with noninlined S-functions.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: ERTFilePackagingFormat
Type: character vector
Value: 'Modular' | 'CompactWithDataFile' | 'Compact'
Default: 'Modular'

Version History

Introduced in R2010a