find
Syntax
Description
returns the elements in the model code mappings of the specified category as an array of
objects.modelElementsFound
= find(myCodeMappingObj
,category
)
returns the elements in the model code mappings of the specified category that match
specified property and value criteria.modelElementsFound
= find(myCodeMappingObj
,category
,Name,Value
)
Examples
Find Model Parameters in Code Mappings
In the model code mappings for model
myConfigModel
, find model workspace parameters.
cm = coder.mapping.api.get('myConfigModel'); modelParams = find(cm,'ModelParameters');
Find Inport Blocks That Have Storage Class Set to Auto
For model myConfigModel
, find
Inport blocks that have storage class set to Auto
. For
each Inport block found, change the storage class setting to Model
default
.
cm = coder.mapping.api.get('myConfigModel'); inportBlkHandles = find(cm,'Inports','StorageClass','Auto'); setInport(cm,inportBlkHandles,'StorageClass','Model default');
Find Entry-Point Functions That Have Memory Section Set to Model default
For model myConfigModel
, find functions that are
configured to use the model default setting for memory sections. For each function found,
change the memory section setting to None
.
cm = coder.mapping.api.get('myConfigModel'); functionObjects = find(cm,'Functions','MemorySection','Model default'); setFunction(cm,funcitonObjects,'MemorySection','None');
Input Arguments
myCodeMappingObj
— Code mapping object
CodeMapping
object
Code mapping object returned by a call to function
coder.mapping.api.get
.
Example: myCM
category
— Model element category
DataStores
| DataTransfers
| ExportedFunctions
| Functions
| FunctionCallers
| Inports
| ModelParameters
| ModelParameterArguments
| Outports
| PartitionFunctions
| PartitionUpdateFunctions
| PeriodicFunctions
| PeriodicUpdateFunctions
| ResetFunctions
| Signals
| SimulinkFunctions
| States
Category of model elements that you search for in the model code mappings.
Example: 'Inports'
Name-Value Arguments
Example: 'Identifier','mp_table1'
Specify optional 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.
StorageClass
— Name of storage class
Auto
| Bitfield
| CompileFlag
| Const
| ConstVolatile
| Define
| Dictionary default
| ExportedGlobal
| ExportToFile
| FileScope
| GetSet
| ImportedDefine
| ImportedExtern
| ImportedExternPointer
| ImportFromFile
| Localizable
| Model default
| Struct
| Volatile
| storage class name
Data element storage class to include in code mappings search criteria. 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.
Identifier
— Code identifier
character vector | string scalar
Name that the code generator uses to identify a data element in generated code.
Applies to storage classes other than Auto
.
Data Types: char
| string
DefinitionFile
— C source file
character vector | string scalar
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
.
Data Types: char
| string
FunctionCustomizationTemplate
— Name of function customization template
character vector | string scalar
Name of a function customization template for a model that is defined in the Embedded Coder Dictionary.
Data Types: char
| string
FunctionName
— Name of entry-point function
character vector | string scalar
Name of an entry-point function generated for a model.
Data Types: char
| string
GetFunction
— Name of get function
character vector | string scalar
Name of a get
function that a data element calls in the
generated code. Applies to storage class GetSet
.
Data Types: char
| string
HeaderFile
— C header file
character vector | string scalar
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
.
Data Types: char
| string
MemorySection
— Name of memory section
character vector | string scalar
Name of a memory section for a model that is defined in the Embedded Coder Dictionary.
Data Types: char
| string
Owner
— Owner of global data
character vector | string scalar
Name of the model that owns global data used by other models in the same model
hierarchy. The code generated for the owner model includes the global data definition.
Applies to storage classes Const
, ConstVolatile
,
ExportToFile
, and Volatile
.
Data Types: char
| string
PreserveDimensions
— Boolean flag indicating whether to preserve dimensions of multidimensional arrays
True
| False
When model configuration parameter Array layout is set to
Row-major
, a flag that indicates whether to preserve
dimensions of a data element that is represented in generated code as a
multidimensional array. Applies to storage classes Const
,
ConstVolatile
, ExportToFile
,
FileScope
, GetSet
,
ImportFromFile
, Localizable
, and
Volatile
.
Data Types: logical
SetFunction
— Name of set function
character string | string scalar
Name of a set
function that a data element calls in the
generated code. Applies to storage class GetSet
.
Data Types: char
| string
StructName
— Name of structure
character vector | string scalar
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
.
Data Types: char
| string
storageClassPropertyName
— Value of storage class property
depends on property definition
Storage class property defined in the model Embedded Coder Dictionary. Values that you can specify vary depending on the storage class definition.
ReceiverService
— Name of receiver service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a receiver service interface
defined in the Embedded Coder Dictionary. Within a target environment, a component
receives data from other components by calling the target platform receiver service.
To use the dictionary default, specify 'Dictionary default'
.
To configure the receiver service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Sender and Receiver Service Interfaces for Model Inports and Outports.
Data Types: char
| string
SenderService
— Name of sender service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a sender service interface
defined in the Embedded Coder Dictionary. Within a target environment, a component
sends data to other components by calling the target platform sender service. To use
the dictionary default, specify 'Dictionary default'
.
To configure the sender service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Sender and Receiver Service Interfaces for Model Inports and Outports.
Data Types: char
| string
MeasurementService
— Name of measurement service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a measurement service interface
defined in the Embedded Coder Dictionary. By configuring the measurement service
interface for signals, states, and data stores, you can preserve the data in the
generated code for measurement. To use the dictionary default, specify
'Dictionary default'
. If data from the state does not need to be
preserved in the code, specify 'Not measured'
.
To configure the measurement service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Measurement Service Interfaces for Signals, States, and Data Stores.
Data Types: char
| string
ParameterTuningService
— Name of parameter tuning service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a parameter tuning service
interface defined in the Embedded Coder Dictionary. To use the dictionary default,
specify 'Dictionary default'
.
To configure the parameter tuning service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Parameter and Parameter Argument Tuning Service Interfaces for Model Parameters and Model Parameter Arguments.
Data Types: char
| string
ParameterArgumentTuningService
— Name of parameter argument tuning service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a parameter argument tuning
service interface defined in the Embedded Coder Dictionary. To use the dictionary
default, specify 'Dictionary default'
.
To configure the parameter argument tuning service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Parameter and Parameter Argument Tuning Service Interfaces for Model Parameters and Model Parameter Arguments.
Data Types: char
| string
TimerService
— Name of timer service interface
Dictionary default
(default) | character vector | string scalar
String or character vector containing the name of a timer service interface
defined in the Embedded Coder Dictionary. To use the dictionary default, specify
'Dictionary default'
.
This property is only applicable for exported functions.
To configure the timer service interface, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model. For more information, see Configure Timer Service Interfaces.
Data Types: char
| string
Output Arguments
modelElementsFound
— Model elements found
array | string vector
Model elements found, returned as an array or string vector of objects. Each object identifies a model element of the specified category. If you specify additional search criteria, the array or string vector includes objects for model elements of the specified category that meet the additional search criteria. The object returned for an element depends on the category that you specify.
Category | Type of Object Returned |
---|---|
Inports, Outports, and States | Block handle |
Signals | Port handle |
DataStores | Block handle |
ModelParameters | Model parameter name |
ModelParameterArguments | Model parameter argument name |
ExportedFunctions, Functions, PartitionFunctions, PartitionUpdateFunctions, PeriodicFunctions, PeriodicUpdateFunctions, ResetFunctions, and SimulinkFunctions | Function |
Version History
Introduced in R2020bR2022b: Model parameters and parameter arguments returned separately by find
function
The find
function now returns model parameter arguments separately
from model parameters.
Starting in R2022b, to return all elements in the model code mappings that are model parameter arguments, enter the following.
cm = coder.mapping.api.get('myConfigModel'); modelParamArgs = find(cm,'ModelParameterArguments');
To return all elements in the model code mappings that are model parameters, enter the following.
cm = coder.mapping.api.get('myConfigModel'); modelParams = find(cm,'ModelParameters');
In previous releases, specifying ModelParameters
as the
category
argument returned both model parameters and model parameter
arguments.
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)