coder.mapping.defaults.set
Set value for property of model default mapping category
Description
coder.mapping.defaults.set(
sets property values for a data or function default mapping category for a model. To
determine valid category, property, and value combinations for a model, use calls
to:model
,category
,property
,value
,...)
coder.mapping.defaults.dataCategories
coder.mapping.defaults.functionCategories
coder.mapping.defaults.allowedProperties
coder.mapping.defaults.allowedValues
Examples
Configure Default Code Generation Settings for Model Output Data
For model ConfigurationInterface
,
configure how the code generator handles model output data by default.
Determine the category name to specify for model output data by calling
coder.mapping.defaults.dataCategories
.
openExample('ConfigurationInterface')
coder.mapping.defaults.dataCategories()
ans = 1×9 cell array Columns 1 through 4 {'Inports'} {'Outports'} {'ModelParameters'} {'ModelParameterA...'} Columns 5 through 8 {'ExternalParamet...'} {'SharedLocalData...'} {'GlobalDataStores'} {'InternalData'} Column 9 {'Constants'}
Specify Outports
as the category name.
Identify properties that you can configure for category
Outports
by calling
coder.mapping.defaults.allowedProperties
.
coder.mapping.defaults.allowedProperties('ConfigurationInterface', 'Outports')
ans = 5×1 cell array {'StorageClass' } {'HeaderFile' } {'DefinitionFile' } {'Owner' } {'PreserveDimensions'}
For this example, set values for properties
StorageClass
, HeaderFile
, and
DefinitionFile
.
Look up the values that you can specify for properties
StorageClass
, HeaderFile
, and
DefinitionFile
.
coder.mapping.defaults.allowedValues('ConfigurationInterface', 'Outports', 'StorageClass')
ans = 10×1 cell array {'Default' } {'ExportedGlobal' } {'ImportedExtern' } {'ImportedExternPointer'} {'Volatile' } {'ExportToFile' } {'ImportFromFile' } {'Localizable' } {'GetSet' } {'MultiInstance' }
coder.mapping.defaults.allowedValues('ConfigurationInterface', 'Outports', 'HeaderFile')
ans = 0×1 empty cell array
coder.mapping.defaults.allowedValues('ConfigurationInterface', 'Outports', 'DefinitionFile')
ans = 0×1 empty cell array
Use a call to function coder.mapping.defaults.set
to
configure the default settings. For category Outports
,
set StorageClass
to ExportToFile
.
Specify exSysOut.h
and exSysOut.c
for
the header and definition files.
coder.mapping.defaults.set('ConfigurationInterface', 'Outports',... 'Storageclass', 'ExportToFile',... 'HeaderFile', 'exSysOut.h',... 'DefinitionFile', 'exSysOut.c')
Configure Default Location in Memory for Storing Code Generated for Model Internal Data
For model ConfigurationInterface
,
configure the default location in memory for storing code generated for model
data elements such as signals, states, and zero crossings.
Determine the category name to specify for model internal data by calling
coder.mapping.defaults.dataCategories
.
openExample('ConfigurationInterface')
coder.mapping.defaults.dataCategories()
ans = 1×9 cell array Columns 1 through 4 {'Inports'} {'Outports'} {'ModelParameters'} {'ModelParameterA...'} Columns 5 through 8 {'ExternalParamet...'} {'SharedLocalData...'} {'GlobalDataStores'} {'InternalData'} Column 9 {'Constants'}
Specify InternalData
as the category name.
Identify properties that you can configure for category
InternalData
by calling
coder.mapping.defaults.allowedProperties
.
coder.mapping.defaults.allowedProperties('ConfigurationInterface', 'InternalData')
ans = 2×1 cell array {'StorageClass' } {'MemorySection'}
To configure the memory location, set the value for property
MemorySection
.
Look up the values that you can specify for property
MemorySection
.
coder.mapping.defaults.allowedValues('ConfigurationInterface', 'InternalData', 'MemorySection')
ans = 2×1 cell array {'None' } {'MemVolatile'}
Use a call to function coder.mapping.defaults.set
to
configure the default setting. For category InternalData
,
set MemorySection
to
internalDataMem
.
coder.mapping.defaults.set('ConfigurationInterface', 'InternalData',... 'MemorySection', 'internalDataMem')
Input Arguments
model
— Name of model
character vector
Model file, specified as a character vector. The model must be loaded (for
example, by using load_system
) or open. You can omit
the .slx
file extension.
Example: 'myLoadedModel'
Data Types: char
category
— Name of default mapping category
character vector
Category name, specified as a character vector. To get valid data and
function category names, call the functions
coder.mappings.defaults.dataCategories
and
coder.mappings.defaults.functionCategories
.
Example: 'ModelParameters'
Data Types: char
property
— Name of property for default mapping category
character vector
Property name, specified as a character vector. To get valid property
names for a default mapping category, call the function
coder.mappings.defaults.allowedProperties
.
Example: 'StorageClass'
Data Types: char
value
— Value of property for default mapping category
character vector
Property value, specified as a character vector. To get a list of values
that you can specify for a category and property combination, call the
function coder.mappings.defaults.allowedValues
.
Example: 'ExportToFile'
Version History
Introduced in R2018a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)