Main Content

clibgen.api.OutputArgumentDefinition

R2026b

MATLAB definition for return type in C++ function or method

Since R2026b

    Description

    A clibgen.api.OutputArgumentDefinition object represents the MATLAB® definition of a C++ output argument.

    Creation

    outDef = fcn.CPPOutput creates an output definition object from the CPPOutput property of a clibgen.api.FunctionDefinition object.

    outDef = methDef.CPPOutput creates an output definition object from the CPPOutput property of a clibgen.api.MethodDefinition object.

    Properties

    expand all

    This property is read-only.

    C++ return type name, represented as "RetValue".

    This property is read-only.

    C++ return type, represented as a string scalar.

    Data type for the argument in MATLAB, specified as a string scalar.

    Dimensions of array data, specified as a numeric vector, string vector, cell array, or "nullTerminated". MATLAB uses this value to determine the number of elements in the pointer data returned from the function. For example:

    • Size = 1, the pointer refers to a single element.

    • Size = 5, the pointer refers to an array of five elements.

    • Size = "len", the number of elements in the array equals the value of the parameter "len".

    • Size = ["m","n"], the pointer refers to a matrix with the number of elements in each dimension equal to the values of the parameters "m" and "n".

    • Size = "nullTerminated", the pointer refers to a C++ string.

    This property is read-only.

    Whether the argument requires additional definition, represented as Complete or Incomplete.

    Doxygen @brief comments for the argument from the header file, specified as a string scalar. You can modify the description in the OutputArgumentDefinition object.

    Object Functions

    Examples

    collapse all

    Display the CPPOutput property of a function definition object.

    The getTemperature function returns a temperature value.

    double getTemperature();

    Publish an interface libname containing getTemperature.

    fcn = findFunction(idef,"getTemperature")
    fcn = 
      FunctionDefinition with properties:
    
                CPPName: "getTemperature"
             MATLABName: "clib.libname.getTemperature"
             Overloaded: false
           CPPSignature: "double getTemperature()"
        MATLABSignature: RetVal = clib.libname.getTemperature()
              CPPInputs: [1×0 clibgen.api.InputArgumentDefinition]
              CPPOutput: [1×1 clibgen.api.OutputArgumentDefinition]
                 Status: Complete
               Included: true
    
      Show all properties
    

    There are no input arguments and one output argument, and the output argument is fully defined:

    • The MATLAB type is double.

    • The argument is scalar (Size=1).

    • The Status is Complete.

    fcn.CPPOutput
    arg = 
      OutputArgumentDefinition with properties:
    
              Name: "RetVal"
           CPPType: "double"
        MATLABType: "double"
              Size: 1
            Status: Complete
    

    Use the MATLABSignature property on the function definition to determine the MATLAB signature and how to call this function in MATLAB after building the interface.

    fcn.MATLABSignature
    ans = 
        "MATLAB signature for FunctionDefinition
         	Maps C++ signature:
         	double getTemperature()
         
         	to MATLAB as:
         	RetVal = clib.libname.getTemperature()
         		Output Arguments
         			RetVal  double
         "
    

    Version History

    Introduced in R2026b