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 onlyIf a pointer argument is used to pass data to the function, then it must appear as an input argument in the MATLAB® signature.
The
DIRECTIONvalue for C-string parameters must be input."output"— Output argument onlyIf 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 argumentIf 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 library definition 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 data | MATLAB Signature |
|---|---|
Input data only to |
% Set DIRECTION = "input"
passData(data)
|
Return data only from |
% Set DIRECTION = "output"
[data] = passData()
|
Input and output data for |
% Set DIRECTION = "inputoutput"
[data] = passData(data)
|
To return multiple outputs, suppose that function calcXY has this
signature:
void calcXY(double *data, double *X, double *Y);| C++ Role for Parameters | Value for DIRECTION | MATLAB Signature |
|---|---|---|
| "input" |
[X,Y] = calcXY(data,X,Y) |
X and Y are input and output
parameters. | "inputoutput" |