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

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.

  1. Declare input, output, and return variables as mxArray * variables. Assign values to the input variables. Initialize output and return variables to NULL.
  2. Make the first output argument the return value from the function.
  3. Pass any additional required or optional output arguments as the first arguments to the function. Pass a NULL argument wherever an optional output argument does not apply to the particular call.
  4. Pass any required or optional input arguments that apply to the C function, following the output arguments. Pass a NULL argument wherever an optional input argument does not apply to the particular call.
Note  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