getFunction
Description
returns the value of a property for the specified model function. Use this function to
return the function customization template or memory section configured for a model
function. For single-tasking periodic functions for which you previously set an argument
specification and for Simulink functions, use this function to return the argument
specification.propertyValue
= getFunction(myCodeMappingObj
,function
,property
)
Examples
Get Function Name Configured for Initialize Function
For model myConfigModel
, get the function name
that is configured for the model initialize function from the model code mappings.
cm = coder.mapping.api.get('myConfigModel'); initFunctionName = getFunction(cm,'Initialize','FunctionName');
Get Memory Section Configured for Periodic Single-Tasking Function
For model myConfigModel
, get the memory section
that is configured for the model periodic single-tasking function from the model code
mappings.
cm = coder.mapping.api.get('myConfigModel'); periodicFunctionMemSec = getFunction(cm,'Periodic','MemorySection');
Get Function Customization Template Configured for Periodic Multitasking Function for Sample Time D2
For model myConfigModel
, get the function
customization template that is configured for the model periodic multitasking function
that corresponds to sample time D2 from the model code mappings.
cm = coder.mapping.api.get('myConfigModel'); periodicD2FunctionTemp = getFunction(cm,'Periodic:D2','FunctionCustomizationTemplate');
Get Argument Specification Configured for Simulink Function
For model myConfigModel
, get the function argument
specification (names, port type, qualifiers, and order) that is configured for the model
Simulink function mySLFunc
from the model code mappings.
cm = coder.mapping.api.get('myConfigModel'); mySLFuncArgs = getFunction(cm,'SimulinkFunction:mySLFunc','Arguments');
Input Arguments
myCodeMappingObj
— Code mapping object
CodeMapping
object
Code mapping object (model code mappings) returned by a call to function
coder.mapping.api.get
.
Example: myCM
function
— Model function
Initialize
| Terminate
| Periodic:slIdentifier
| Partition:slIdentifier
| PeriodicUpdate:slIdentifier
| PartitionUpdate:slIdentifier
| Reset:slIdentifier
| ExportedFunction:slIdentifier
| SimulinkFunction:slIdentifier
Model function for which to return a code mapping property value. Specify one of the values listed in this table. If model configuration parameter Single output/update function is cleared, you can specify the update version of a partition, periodic multi-tasking, or periodic singletasking function.
Type of Model Function | Value |
---|---|
Exported function | ExportedFunction: ,
where is the name of
the function-call Inport block in the model |
Initialize function | Initialize |
Partition function | Partition: , where
is a partition
that was created explicitly from a block in the model and shown in the
Simulink® Schedule Editor (for example, P1 ), or a task
name in the Concurrent Execution dialog. |
Partition update function | PartitionUpdate: ,
is a partition that was created explicitly from a block in the model and shown
in the Simulink Schedule Editor (for example, P1 ), or a task
name in the Concurrent Execution dialog. |
Periodic multitasking function | Periodic: , where
is an annotation
that corresponds to the sample time period for a periodic or continuous rate of
a multi-tasking model (for example, D1 ) |
Periodic multitasking update function | PeriodicUpdate: ,
where is an
annotation that corresponds to the sample time period for a periodic or
continuous rate of a multi-tasking model (for example, D1 )
|
Periodic single-tasking function | Periodic |
Periodic single-tasking update function | PeriodicUpdate |
Reset function | Reset: , where
is the name of
the reset function in the model |
Simulink function | SimulinkFunction: ,
where is the name of
the Simulink function in the model |
Terminate function | Terminate |
For information about model partitioning, see Create Partitions.
Example: 'Periodic:D1'
property
— Code mapping property value to return
FunctionCustomizationTemplate
| MemorySection
| FunctionName
| Arguments
| TimerService
Code mapping property value to return. Specify one of the property names listed in this table.
Information to Return | Property Name |
---|---|
Function customization template setting for the specified function | FunctionCustomizationTemplate |
Memory section associated with the specified function | MemorySection |
Name to use for the function in the generated code | FunctionName |
For periodic, single-tasking functions and Simulink functions, a string that shows the names, type qualifiers, and order of arguments as they will appear in the generated code | Arguments |
Name of timer service defined in Embedded Coder Dictionary | TimerService |
Example: 'FunctionCustomizationTemplate'
Output Arguments
propertyValue
— Name of function customization template, memory section, function, or argument specification
character vector | string scalar
Name of the function customization template, memory section, function, or argument specification returned as a character vector or string scalar.
Data Types: char
| string
Version History
Introduced in R2020b
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.
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)