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
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')
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 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, 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, 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
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)