setDataDefault
R2026bSet default code settings for data category
Description
setDataDefault(
sets the default storage class and storage class property values in the code mappings for
the specified category of model data.myCoderDictionaryObj,category,Name,Value)
Examples
View and modify data defaults of an Embedded Coder® dictionary configured with data interface configuration.
Use the function Simulink.data.dictionary.create to create the
dictionary file dataDict.sldd and the associated
Simulink.data.Dictionary object. Then use the function
coder.dictionary.create to create the data interface Embedded Coder dictionary object, and store handles to the objects in
variables.
dictFile = "dataDict.sldd"; simDictObj = Simulink.data.dictionary.create(dictFile); ecoderDataDictObj = coder.dictionary.create(dictFile,"DataInterface");
Use the function coder.mapping.api.get() with the dictionary
file name to get a handle to the mapping object of the dictionary mapping object and
store it in the variable
dictMapObj.
dictMapObj = coder.mapping.api.get(dictFile);
Use the function setDataDefault to set the default dictionary
value for the storage class of outports, then use the function
getDataDefault to verify that the default has been
updated.
setDataDefault(dictMapObj,"Outports",StorageClass="ExportedGlobal") getDataDefault(dictMapObj,"Outports","StorageClass")
ans = 'ExportedGlobal'
Input Arguments
Coder dictionary object returned by a call to function
coder.mapping.api.get.
Category of data elements to return a property value for.
Example: 'Inports'
Name-Value Arguments
Example: 'StorageClass','ExportedGlobal'
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.
Storage 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'
File 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
Name 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
File 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
Name of a memory section that is defined in the Embedded Coder Dictionary associated with the model.
Example: 'MemorySection','myFastMem'
Data Types: char | string
Name 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
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
Name 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
Name 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'
Storage class property defined in the Embedded Coder Dictionary. Values that you can specify vary depending on the storage class definition.
Data Types: char | string
Version History
Introduced in R2021a
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)