Main Content

Define Missing DIRECTION Parameter

In C++, pointer arguments can be used to pass and return data from a function. Use the DIRECTION parameter to specify if the argument is read-only input, output only, or a modifiable input argument.

The DIRECTION parameter has one of these values:

  • "input"—Input argument only

    If a pointer argument is used to pass data to the function, then it must appear as an input argument in the MATLAB® signature.

    The DIRECTION value for C-string parameters must be input.

  • "output"—Output argument only

    If a pointer argument is used to retrieve data from the function, then it must appear as an output argument in the MATLAB signature.

  • "inputoutput"—Input and output argument

    If a pointer argument is used to both pass and return data, then it must appear as both an input argument and an output argument.

Note

Default arguments with direction specified as OUT are not supported. Define these with DIRECTION as "input" or "inputoutput" in the MLX file.

For example, suppose that a C++ function passData has the following signature. The argument data might be an input to the function, the return value of the function, or input that the function modifies and returns. The documentation of the function tells you how the function uses the argument data.

void passData(double *data); 

Assuming data is a scalar double value, this table shows the MATLAB signature based on its role.

C++ Role for dataMATLAB Signature

Input data only to passData

% Set DIRECTION = "input"
passData(data) 

Return data only from passData

% Set DIRECTION = "output"
[data] = passData() 

Input and output data for passData

% Set DIRECTION = "inputoutput"
[data] = passData(data)