defineOutput

Class: clibgen.FunctionDefinition
Package: clibgen

Add output argument definition for C++ package function

Syntax

defineOutput(funcDef,argName,mltype)
defineOutput(funcDef,argName,mltype,shape)

Description

defineOutput(funcDef,argName,mltype) adds an output argument definition.

defineOutput(funcDef,argName,mltype,shape) provides information about data dimensions.

Input Arguments

expand all

Function definition, specified as a clibgen.FunctionDefinition object.

C++ output argument name, specified as a string scalar or a character vector.

MATLAB® type, specified as a string scalar or a character vector.

Dimension definition used by MATLAB to define data dimensions, specified as a string vector, scalar text, positive integer vector, "nullTerminated", or a cell array. For a cell array, the elements are a combination of scalar text and scalar positive integers.

If you can define the argument dimension as a fixed scalar value, then enter a number, such as 5.

If the dimension is defined by another argument, then enter the argument name as a string. For example, consider the following C++ signature. If argument len defines the length of data, then the value of shape is "len".

myFunc(const int *data, int len)

If the size of an argument is defined by an array, then the value of shape is one of the following:

  • 1

  • Fixed dimensions: Enter a numerical array, such as [5,2].

  • Variable dimensions: Enter a string array of parameter names, such as ["row","col"]

If the C++ type for the argument is a string, then use these options to choose values for the mltype and shape arguments.

C++ TypemltypeOptions for shape
char *

int8

Scalar value
Array of scalar values

const char *

char

MATLAB char
Character vector

string

"nullTerminated"

For more information, see MATLAB to C++ Data Type Mapping.

Introduced in R2019a