主要内容

Simulink.CustomCode.FunctionPortSpecification Class

R2026b

Namespace: Simulink.CustomCode

Query and configure C Caller block properties

Description

Query and configure the C Caller block function definition and return argument. Configure the C Caller block input arguments programmatically.

The Simulink.CustomCode.FunctionPortSpecification class is a handle class.

Creation

myCCallerObj = get_param(gcb, 'FunctionPortSpecification') creates a C Caller block configuration object for the selected C Caller block.

Properties

expand all

C function mapping to the C Caller block in the model, specified as character vector. You cannot edit this property at the command line. To edit the C function mapping, edit the source code of the C Caller block.

Example: real_T add(real_T u1, real_T u2);

Data Types: char

List function input arguments, specified as FunctionArgument objects.

Data Types: FunctionArgument

Function output argument, returned as a FunctionArgument object.

Data Types: FunctionArgument

List global arguments in function interface, returned as FunctionArgument objects.

Data Types: FunctionArgument

Methods

expand all

Examples

collapse all

Open the model from the example Call Custom C Functions in Simulink Using C Caller Block.

openExample('simulink/ArithmeticOperationsUsingCCallerBlocksExample')
open_system('CCallerExample.slx')

Create a C Caller block configuration object using the model named CCallerExample.

 my_CCallerObj = get_param('CCallerExample/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]

Create a 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'
 FunctionArgument with properties:

          Name: 'u1'
    PortNumber: 1
          Size: '1'
          Type: 'double'
         Label: 'inputport1'
         Scope: 'Input'

Version History

Introduced in R2019b