C Math Library Reference | ![]() ![]() |
Constructing a C Prototype
One C prototype supports all the possible ways to call a particular MATLAB C Math Library function. You can reconstruct the C prototype by examining the MATLAB syntax for a function.
For example, the MATLAB function svd()
has the following syntax:
s = svd(X) [U,S,V] = svd(X) [U,S,V] = svd(X,0)
To construct the C prototype for mlfSvd()
, follow this procedure.
[U,S,V] = svd(X,0)
U
, as the return value from the C version of the function. (C routines can only have one return value.) The data type for the return value is mxArray *
.
S
and V
, as output arguments to the C function. Output arguments appear before any input arguments in the argument list. The second return value becomes the first output argument, as so on. The data type for the C output arguments is mxArray **
.
mxArray *
.
Here is the complete C prototype for the svd
function. Compare it to the original MATLAB syntax.
mxArray *mlfSvd(mxArray **S, mxArray **V, mxArray *X, mxArray *Zero);
![]() | C Math Library Calling Conventions | Translating MATLAB Syntax into C Syntax | ![]() |