Set default storage class and storage class property values for model data category
setDataDefault(
sets the default storage class and storage class property values in the code mappings for
the specified category of model data.myCodeMappingObj
,category
,Name,Value
)
In the model code mappings for model
myConfigModel
, configure the default representation of model workspace
parameters in generated code as unstructured global variables by setting the default
storage class to ExportedGlobal
.
cm = coder.mapping.api.get('myConfigModel'); setDataDefault(cm,'ModelParameters','StorageClass','ExportedGlobal');
In the model code mappings for model
myConfigModel
, configure the code generator to write root-level outport
data to separate global variables declared and defined in external files
myextheader.h
and myextsrc.c
.
cm = coder.mapping.api.get('myConfigModel'); setDataDefault(cm,'Outports','StorageClass','ExportToFile',... 'HeaderFile',myextheader.h','DefinitionFile','myextsrc.c');
myCodeMappingObj
— Code mapping objectCodeMapping
objectCode mapping object (model code mappings) returned by a call to function
coder.mapping.api.get
.
Example: myCM
category
— Model element categoryConstants
| ExternalParameterObjects
| GlobalDataStores
| Inports
| InternalData
| ModelParameters
| ModelParameterArguments
| Outports
| SharedLocalDataStores
Category of model data element for which to set the storage class and storage class properties.
Example: 'Inports'
Specify comma-separated pairs of Name,Value
arguments.
Name
is the argument name and Value
is the
corresponding value. Name
must appear inside quotes. You can specify
several name and value pair arguments as Name1,Value1,…,NameN,ValueN
. The
order of the name and value pair arguments does not matter.
'StorageClass'
— Name of storage classAuto
| Bitfield
| CompileFlag
| Const
| ConstVolatile
| Define
| Dictionary default
| ExportedGlobal
| ExportToFile
| FileScope
| GetSet
| ImportedDefine
| ImportedExtern
| ImportedExternPointer
| ImportFromFile
| Localizable
| Model default
| Struct
| Volatile
| storage class nameStorage class to set for the specified data element category. The name of a predefined storage class or storage class that is defined in the Embedded Coder Dictionary associated with the model. Values that you can specify vary depending on the category that you specify. See Choose Storage Class for Controlling Data Representation in Generated Code.
Example: 'StorageClass','ImportedExtern'
'DefinitionFile'
— C source fileFile name for a C source file that contains definitions for global data read by
data elements and external code. Applies to storage classes Const
,
ConstVolatile
, ExportToFile
, and
Volatile
.
Example: 'DefinitionFile','myDataDefs.c'
Data Types: char
| string
'GetFunction'
— Name of get functionName of a get
function that a data element calls in the
generated code. Applies to storage class GetSet
.
Example: 'GefFunction','myDataGetFunction'
Data Types: char
| string
'HeaderFile'
— C header fileFile name for a C header file that contains declarations for global data read by
data elements and external code. Applies to storage classes Const
,
ConstVolatile
, Define
,
ExportToFile
, GetSet
,
ImportedDefine
, ImportFromFile
, and
Volatile
.
Example: 'HeaderFile','myDataDecl.h'
Data Types: char
| string
'MemorySection'
— Name of memory section Name of a memory section that is defined in the Embedded Coder Dictionary associated with the model.
Example: 'MemorySection','myFastMem'
Data Types: char
| string
'Owner'
— Owner of global dataName of the model that owns global data, which is used by other models in the same
model hierarchy. The code generated for the model that owns the data includes the
global data definition. Applies to storage classes Const
,
ConstVolatile
, ExportToFile
, and
Volatile
.
Example: 'Owner','myModelA'
Data Types: char
| string
'PreserveDimensions'
— Boolean flag indicating whether to preserve dimensions of multidimensional arraysTrue
| False
When model configuration parameter Array layout is set to
Row-major
, a flag that indicates whether to preserve
dimensions of a data element represented in generated code as a multidimensional
array. Applies to storage classes Const
,
ConstVolatile
, , ExportToFile
,
FileScope
, ImportFromFile
,
Localizable
, and Volatile
.
Example: 'PreserveDimensions','True'
Data Types: logical
'SetFunction'
— Name of set functionName of a set
function that a data element calls in the
generated code. Applies to storage class GetSet
.
Example: 'SetFunction','myDataSetFunction'
Data Types: char
| string
'StructName'
— Name of structureName that the code generator uses to identify the structure for a data element in
the generated code. Applies to storage classes Bitfield
and
Struct
.
Example: 'StructName','myDataStruct'
'storageClassPropertyName'
— Value of storage class propertyStorage class property defined in the Embedded Coder Dictionary. Values that you can specify vary depending on the storage class definition.
Data Types: char
| string
coder.mapping.api.CodeMapping
| coder.mapping.api.get
| getDataDefault