getData - Get code mapping configuration for model data - MATLAB (original) (raw)
Get code mapping configuration for model data
Since R2021a
Syntax
Description
[value](#mw%5F4bf2dd28-f426-43cd-836f-61dd34c9f8b1) = getData([myCPPMappingObj](#mw%5F25e4930c-4bbc-4242-8536-75a22d428349), [category](#mw%5F7cc0d0b9-b3bb-4fa3-8bd9-2f9305fa70e5), [property](#mw%5Fc59beb75-df5c-4f83-8965-f01f3c3fa797))
returns the code mapping information for the property specified byproperty
and the model data category specified bycategory
.
Examples
Get the data visibility of model parameters.
Open the model. Use the coder.mapping.api.get
function to access the CodeMappingCPP
object associated with the model.
open_system('CppClassRateBased'); cm = coder.mapping.api.get('CppClassRateBased');
To view the data visibility of the model parameters, use the getData
function.
value = getData(cm, 'ModelParameters', 'DataVisibility')
To configure the data visibility, specify the 'DataVisibility'
parameter by using the setData
function.
setData(cm, 'ModelParameters', 'DataVisibility', 'private');
Input Arguments
Category of model data to access, specified as one of these categories.
Category | Description |
---|---|
'Inports' | Root-level input ports of a model, such as Inport and In Bus Element blocks. |
'Outports' | Root-level output ports of a model, such as Outport and Out Bus Element blocks. |
'ModelParameters' | Parameters that are defined within a model, such as parameters in the model workspace. Excludes model arguments. |
'ModelParameterArguments' | Parameters in the model workspace configured as model arguments. These parameters are exposed at the model block to enable each model instance to provide its own value. |
'InternalData' | Data elements that are internal to a model, such as block output signals, discrete block states, data stores, and zero-crossing signals. |
Data Types: char
| string
Property of model data to access, specified as'MemberAccessMethod'
, 'DataVisibility'
, or'DataAccess'
.
The MemberAccessMethod
property specifies how the methods, if any, are generated for the data elements.
The DataVisibility
property specifies the visibility (private
, public
, orprotected
) of the data category in the generated code.
The DataAccess
property specifies whether model elements are stored by value ('Direct'
) or pointer ('Pointer'
) in the generated code. Data access is configurable for 'Inports'
,'Outports'
, and 'ModelParameterArguments'
categories:
'Inports'
whose member access method is set to'Structure-based method'
or'Inlined structure-based method'
.'Outports'
whose member access method is set to'Structure-based method'
or'Inlined structure-based method'
.'ModelParameterArguments'
whose data visibility is set to'private'
(not'Individual Arguments'
).
Data Types: char
| string
Output Arguments
The code mapping property value of the specified category, returned as a character vector.
Version History
Introduced in R2021a