getFunction
Get code configuration from code mappings for model function
Description
returns the value of a property for the specified model function.propertyValue = getFunction(myCPPMappingObj,methodID,property)
Examples
Open the model. To access the CodeMappingCPP object associated with the model, use the coder.mapping.api.get function.
open_system('CppClassRateBased'); cm = coder.mapping.api.get('CppClassRateBased');
To access the method name of the initialize function for the model, use the getFunction function. If you did not specify a method name for the initialize function, getFunction returns an empty character vector, and the method name in the generated code uses the default method name.
value = getFunction(cm, 'Initialize', 'MethodName')
value = 'initIntegrator'
Specify a method name for the initialize function by using the setFunction function.
setFunction(cm, 'Initialize', 'MethodName', 'my_$N')
The getFunction function now returns the specified method name.
value = getFunction(cm, 'Initialize', 'MethodName')
value = 'my_$N'
Input Arguments
C++ code mapping object, returned by a call to either the coder.mapping.utils.create function or the coder.mapping.api.get function.
The identifier of the model method to get the code mappings property value of, specified as one of the values in the table.
| Type of Model Method | Method Identifier |
|---|---|
| Initialize method |
|
| Terminate method |
|
| Reset method |
|
| Periodic method |
Example: Tip For a single-tasking periodic method, you can use
|
| Periodic update method |
Example: Tip For a single-tasking periodic update method, you can use
|
| Partition method |
Example: |
| Partition update method |
Example: |
| Simulink function |
|
| Exported method |
|
Tip
When the configuration parameter Single output/update function is cleared, you can specify the update method that corresponds to a partition, periodic multitasking, or periodic single-tasking method. For more information about generating code with a single method for both update and output, see Single output/update function.
For information about model partitioning, see Create Partitions. To learn more about annotations and sample time information, see Specify Sample Time. To learn how to programmatically obtain sample time information, see simulink.schedule.OrderedSchedule.
Code mapping property value to return. Specify one of the property names listed in this table.
| Information to Return | Property Name |
|---|---|
| Name to use for the method in the generated code | MethodName |
| For periodic, single-tasking functions and Simulink functions, a string that shows the block names, argument names, type qualifiers, and order of arguments as they will appear in the generated code | Arguments |
Example: 'MethodName'
Output Arguments
Name of the function or argument specification returned as a character vector or string scalar.
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)