Main Content

Data declaration

Location for data declarations

Model Configuration Pane: Code Generation / Code Placement


Specify where extern, typedef, and #define statements are to be declared.


This parameter enables Data declaration filename.


Auto (default) | Data declared in source file | Data defined in a single separate source file

Default: Auto


Lets the code generator determine where the declarations should be located.

Data declared in source file

Places declarations in .c source files where functions are located. The data header template file is not used. The code generator places the declarations in one or more function .c files, depending on the number of function source files and the file partitioning previously selected in the Simulink® model.

Data defined in a single separate source file

Places declarations in the data header file specified in the Data declaration filename field. The code generator organizes and formats the declarations based on the data header template specified by the header file (*.h) template parameter in the data section of the Code Generation pane: Templates tab.


This parameter applies to data with storage classes except these:

  • ExportedGlobal

  • ImportedExtern

  • ImportedExternPointer

  • BitField

  • FileScope

  • Localizable

  • Struct

  • CompilerFlag

Recommended Settings

DebuggingNo impact
TraceabilityA valid value
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: GlobalDataReference
Type: character vector
Value: 'Auto' | 'InSourceFile' | 'InSeparateHeaderFile'
Default: 'Auto'

Version History

Introduced in R2006a