| C Math Library Reference | ![]() |
Translating MATLAB Syntax into C Syntax
This procedure demonstrates how to translate the MATLAB svd() calls into MATLAB C Math Library calls to mlfSvd(). The procedure applies to library functions in general.
In this procedure, mlfAssign(), rather than the assignment operator (=), assigns the return value from mlfSvd() to an array variable. This usage indicates that the automated memory management provided by the library is in effect.
Note that within a call to a MATLAB C Math Library function, an output argument is preceded by &; an input argument is not.
MATLAB Syntax
s = svd(X) [U,S,V] = svd(X) [U,S,V] = svd(X,0)
The MATLAB arguments to svd() fall into these categories:
U (or s) is a required output argument.
S and V are optional output arguments.
X is a required input argument.
0 is an optional input argument.
mxArray * variables. Assign values to the input variables. Initialize output and return variables to NULL.
mlfAssign(&s, mlfAssign(&U, mlfAssign(&U,
NULL argument wherever an optional output argument does not apply to the particular call.
mlfAssign(&s, mlfSvd(NULL,NULL, mlfAssign(&U, mlfSvd(&S,&V, mlfAssign(&U, mlfSvd(&S,&V, s = mlfSvd(NULL,NULL, U = mlfSvd(&S,&V, U = mlfSvd(&S,&V,
NULL argument wherever an optional input argument does not apply to the particular call.
mlfAssign(&s, mlfSvd(NULL,NULL,X,NULL)); mlfAssign(&U, mlfSvd(&S,&V,X,NULL)); mlfAssign(&U, mlfSvd(&S,&V,X,Zero));
NULL arguments always follow significant arguments; a NULL argument cannot appear between two output arguments or between two input arguments. Move the significant output or input argument before the NULL argument.
| Constructing a C Prototype | Function Reference | ![]() |