setDataDefault - Set default code settings for data category - MATLAB (original) (raw)

Set default code settings for data category

Since R2021a

Syntax

Description

setDataDefault([myCoderDictionaryObj](#mw%5F61e42653-f222-4851-9385-4c59551c01bc),[category](#mw%5Ff338baa1-bf69-4654-8be0-9bef95bac20c),[Name,Value](#namevaluepairarguments)) sets the default storage class and storage class property values in the code mappings for the specified category of model data.

example

Examples

collapse all

Use the coder.mapping.api.get function to access theCoderDictionary object associated with the data dictionary.

cm = coder.mapping.api.get('codeDefinitions.sldd');

To see the storage class of root-level inports for the dictionary, use thegetDataDefault function.

value = getDataDefault(cm, 'Inports', 'StorageClass')

The dictionary uses the default storage class for inports.

To configure the storage class, use the setDataDefault function.

setDataDefault(cm, 'Inports', 'StorageClass', 'ExportedGlobal')

To verify that the storage class of inports is now set toExportedGlobal, use the getDataDefault function.

value = getDataDefault(cm, 'Inports', 'StorageClass')

Input Arguments

collapse all

Coder dictionary object returned by a call to functioncoder.mapping.api.get.

Category of data elements to return a property value for.

Example: 'Inports'

Name-Value Arguments

collapse all

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, andVolatile.

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, andVolatile.

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, andVolatile.

Example: 'Owner','myModelA'

Data Types: char | string

When model configuration parameter Array layout is set toRow-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 andStruct.

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