Main Content

Simulink.dictionary.archdata.FunctionArgument

Function argument in function element of client-server interface

Since R2023b

    Description

    a FunctionArgument object describes the attributes of an argument in a function element of a client-server interface. The function element is a Simulink.dictionary.archdata.FunctionElement object.

    Creation

    After configuring the function prototype of a Simulink.dictionary.archdata.FunctionElement object, get the function argument using the getFunctionArgument function.

    functionArgObj = getFunctionArgument(functionElemObj,"y")

    Properties

    expand all

    Function argument name, specified as a character vector or string scalar.

    Example: "y"

    Data Types: char | string

    Type of the function argument, specified as a Simulink.dictionary.archdata.ValueType object.

    Description of the function argument, specified as a character vector or a string scalar.

    Data Types: char | string

    Dimensions of the function argument, specified as a character vector or string scalar.

    Data Types: char | string

    Function element containing the function argument, specified as a Simulink.dictionary.archdata.FunctionElement object.

    Object Functions

    moveToDictionaryMove architectural data of Simulink data dictionary to another data dictionary
    moveToDesignDataMove interfaces, data types, and constants in Architectural Data section of Simulink data dictionary to design data
    showView architectural data of Simulink data dictionary in Architectural Data Editor
    destroyDelete data element and remove from data interface

    Examples

    collapse all

    A function element describes attributes of a function in a client-server interface such as the function prototype, and whether the function is executed asynchronously. A function argument describes the attributes of a single argument of a function, such as dimensions, and data type.

    In this example, the dictionary MyInterfaces.sldd contains one service interface, which contains three function elements.

    archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
    archDataObj = 
    
      ArchitecturalData with properties:
    
        DictionaryFileName: 'MyInterfaces.sldd'
                Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
                 DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
                 Constants: [0×0 Simulink.dictionary.archdata.Constant]

    To access the service interface, use the getInterface function.

    serviceInterfaceObj = getInterface(archDataObj,"ServiceInterface1")
    serviceInterfaceObj = 
    
      ServiceInterface with properties:
    
               Name: 'ServiceInterface1'
        Description: ''
           Elements: [1×3 Simulink.dictionary.archdata.FunctionElement]
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Each function element contains two function arguments. View the first function element.

    funcElemObj1 = serviceInterfaceObj.Elements(1)
    ans = 
    
      FunctionElement with properties:
    
        FunctionPrototype: 'y = functionElement1(u)'
             Asynchronous: 0
        FunctionArguments: [1×2 Simulink.dictionary.archdata.FunctionArgument]
                     Name: 'functionElement1'
                    Owner: [1×1 Simulink.dictionary.archdata.ServiceInterface]

    View the attributes of the first function argument.

    funcArg1 = funcElemObj1.FunctionArguments(1)
    funcArg1 = 
    
      FunctionArgument with properties:
    
               Name: 'u'
               Type: [1×1 Simulink.dictionary.archdata.ValueType]
        Description: ''
         Dimensions: '1'
              Owner: [1×1 Simulink.dictionary.archdata.FunctionElement]

    Configure the dimensions and description of function argument funcArg1, u.

    funcArg1.Dimensions = "2";
    funcArg1.Description = "Input argument"
    funcArg1 = 
    
      FunctionArgument with properties:
    
               Name: 'u'
               Type: [1×1 Simulink.dictionary.archdata.ValueType]
        Description: 'Input argument'
         Dimensions: '2'
              Owner: [1×1 Simulink.dictionary.archdata.FunctionElement]

    Version History

    Introduced in R2023b