getDataDefault
Get default storage class or storage class property setting for model data category
Since R2020b
Description
returns the value from the code mappings of the specified property for the specified data
category.propertyValue
= getDataDefault(myCodeMappingObj
,category
,property
)
You cannot specify default data interfaces for models with an attached Embedded Coder Dictionary that defines a service interface configuration.
Examples
Get Default Storage Class Setting for Root-Level Inports
From the model code mappings for model
myConfigModel
, get the default storage class setting for root-level
inports.
cm = coder.mapping.api.get('myConfigModel'); defaultStorageClass = getDataDefault(cm,'Inports','StorageClass');
Get Default Header File Setting for Root-Level Inports
From the model code mappings for model
myConfigModel
, get the default header file setting for root-level
inports.
cm = coder.mapping.api.get('myConfigModel'); defaultInputHeaderFile = getDataDefault(cm,'Inports','HeaderFile');
Input Arguments
myCodeMappingObj
— Code mapping object
CodeMapping
object
Code mapping object (model code mappings) returned by a call to function
coder.mapping.api.get
.
Example: myCM
category
— Model data element category
Constants
| ExternalParameterObjects
| GlobalDataStores
| Inports
| InternalData
| ModelParameters
| ModelParameterArguments
| Outports
| SharedLocalDataStores
Category of model data elements that you return a property value for.
Example: 'Inports'
property
— Code mapping property value to return
StorageClass
| Identifier
| DefinitionFile
| GetFunction
| HeaderFile
| MemorySection
| Owner
| PreserveDimensions
| SetFunction
| StructName
| storage class property name
Code mapping property that you return a value for. Specify one of these property names or a property name for a storage class defined in the Embedded Coder Dictionary associated with the model.
Note
You cannot directly retrieve or configure the default
MemorySection
for the ModelParameterArguments
category using the code mapping object. To configure the default
MemorySection
for ModelParameterArguments
,
define a custom StorageClass
with the
MemorySection
in a coder dictionary, and set this storage class
as the default for ModelParameterArguments
.
Information to Return | Property Name |
---|---|
Name of storage class | StorageClass |
Name of variable for data element in the generated code | Identifier |
Name of source definition file that contains definitions for global data that is read by the data element and external code | DefinitionFile |
Name of get function called by code generated for the
data element | GetFunction |
Name of source header file that contains declarations for global data that is read by the model data element and external code | HeaderFile |
Name of a memory section that is defined in the Embedded Coder Dictionary associated with the model | MemorySection |
Name of model for which the code generator places the definition for data element shared by multiple models in a model hierarchy | Owner |
Boolean value indicating whether code generator preserves dimensions of data that is represented as a multidimensional array | PerserveDimensions |
Name of set function called by code generated for data
element | SetFunction |
Name of structure in generated code for data element | StructName |
Example: 'Identifier'
Output Arguments
propertyValue
— Name of storage class or value of storage class property
character vector | string scalar | Auto
| Bitfield
| CompileFlag
| Const
| ConstVolatile
| Define
| Dictionary default
| ExportedGlobal
| ExportToFile
| FileScope
| GetSet
| ImportedDefine
| ImportedExtern
| ImportedExternPointer
| ImportFromFile
| Localizable
| Model default
| Struct
| Volatile
The property value is one of these values depending on the category and property that you specify.
Property | Value Returned |
---|---|
DefinitionFile | Character vector or string scalar that names 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 . |
GetFunction | Character vector or string scalar that names a get
function that a data element calls in the generated code. Applies to storage
class GetSet . |
HeaderFile | Character vector or string scalar that names 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 . |
MemorySection | Character vector or string scalar that names a memory section for a model defined in the Embedded Coder Dictionary. |
Owner | Character vector or string scalar that names the model that owns global
data, which is used by other models in the same model hierarchy. The code
generated for the owner model includes the global data definition. Applies to
storage classes Const , ConstVolatile ,
ExportToFile , and Volatile . |
PerserveDimensions | Boolean flag that indicates whether to preserve dimensions of a data
element that is represented in generated code as a multidimensional array.
Applies to storage classes Const ,
ConstVolatile , ExportToFile ,
FileScope , ImportFromFile ,
Localizable , and Volatile . |
SetFunction | Character vector or string scalar that names a
|
StorageClass | One of these values: Auto ,
Bitfield , CompileFlag ,
Const , ConstVolatile ,
Define , Dictionary default ,
ExportedGlobal ,
ExportToFile , FileScope ,
GetSet , ImportedDefine ,
ImportedExtern , ImportedExternPointer ,
ImportFromFile , Localizable ,
Model default , Struct ,
Volatile |
StructName | Character vector or string scalar that names that names a structure for a
data element in the generated code. Applies to storage classes
Bitfield and Struct . |
Data Types: char
| string
Version History
Introduced in R2020b
See Also
coder.mapping.api.CodeMapping
| coder.mapping.api.get
| setDataDefault
Topics
- C Data Code Interface Configuration for Model Interface Elements
- Configure Root-Level Inport Blocks for C Code Generation
- Configure Root-Level Outport Blocks for C Code Generation
- Configure Signal Data for C Code Generation
- Configure Parameters for C Code Generation
- Configure Block States for C Code Generation
- Configure Data Stores for C Code Generation
- Configure Default C Code Generation for Categories of Data Elements and Functions
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)