FunctionArgument
Specify parameters of C Caller block inputs and outputs
Description
Use the FunctionArgument
object to customize the types, scopes,
and names of inputs and outputs for a C Caller block.
Use this object to set the InputArguments,
ReturnArgument, and GlobalArguments parameters
of the FunctionPortSpecification
object for a C Caller block or a Simulink.CodeImporter.SimulinkPortSpecification
object for the Simulink® Code Importer.
Properties
Name
— Name of variable in source code
string | character vector
This property is read-only.
Name of the variable in the source code, specified as a string or a character vector.
Data Types: char
| string
PortNumber
— Port number of argument
uint32
This property is read-only.
Port number of the argument.
Data Types: uint32
Size
— Size of argument
string | character vector
Size of the argument, specified as a string or a character vector.
Example: [3]
Data Types: char
| string
Type
— Data type of argument
string | character vector
Data type of the argument, specified as a string or a character vector.
Example: double
Data Types: char
| string
Label
— Label of argument on C Caller block
string | character vector
Label of the argument on the C Caller block, specified as a string or a character vector.
Example: MyArg
Data Types: char
| string
Scope
— Mapping of argument to Simulink port type
"Input"
| "Output"
| "InputOutput"
| "Parameter"
Mapping of argument to a Simulink port type, specified as "Input"
,
"Output"
, "InputOutput"
, or
"Parameter"
. If the argument has a const
modifier, you can set "Input"
or "Parameter"
.
Otherwise, you can change an output argument to "Input"
,
"InputOutput"
, or "Parameter"
.
Data Types: char
| string
Examples
Change Argument Label for C Caller Block
Open the model from the example Call C Functions Using C Caller Block.
openExample('simulink_features/CallCFunctionsUsingCCallerBlockExample') open_system('slexCCallerExample.slx')
Get a C Caller block configuration object using the model
slexCCallerExample
.
my_CCallerObj = get_param("slexCCallerExample/C Caller",... "FunctionPortSpecification")
my_CCallerObj = FunctionPortSpecification with properties: CPrototype: 'real_T add(real_T u1, real_T u2);' InputArguments: [1×2 Simulink.CustomCode.FunctionArgument] ReturnArgument: [1×1 Simulink.CustomCode.FunctionArgument] GlobalArguments: [1×0 Simulink.CustomCode.FunctionArgument]
Get the FunctionArgument
object for the first input port.
inargone = my_CCallerObj.InputArguments(1)
inargone = FunctionArgument with properties: Name: 'u1' PortNumber: 1 Size: '1' Type: 'double' Label: 'u1' Scope: 'Input'
Change the label for the first input port.
inargone.Label = "inputport1"
inargone = FunctionArgument with properties: Name: 'u1' PortNumber: 1 Size: '1' Type: 'double' Label: 'inputport1' Scope: 'Input'
Version History
Introduced in R2019b
See Also
Blocks
Objects
Classes
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)