Main Content

FunctionPortSpecification

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.

Creation

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

Properties

expand all

Displays the mapping of the C function input to the C Caller block in the model. You cannot edit this property using 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

Returns the list of function input arguments as FunctionArgument objects.

Data Types: FunctionArgument

Returns the output argument as a FunctionArgument object.

Data Types: FunctionArgument

Returns the list of function interface global arguments as FunctionArgument objects.

Data Types: FunctionArgument

Object Functions

getGlobalArgGet object definition of global variable in C Caller block
addGlobalArgSelectively add global variable from custom code to C Caller block as global argument
deleteGlobalArgSelectively delete global arguments from C Caller block

Examples

collapse all

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

openExample('simulink_features/CallCFunctionsUsingCCallerBlockExample')
open_system('slexCCallerExample.slx')

Create a C Caller block configuration object using the model named 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]

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