Using the C++ Math Library | ![]() ![]() |
Passing Optional Input and Output Arguments
Finally, a MATLAB function may have both optional input and optional output arguments. The MATLAB C++ Math Library provides multiple overloaded functions to implement the various calls. The svd()
function, for example, has three forms. The first takes one input and returns one output. The second takes one input and returns three outputs. The third takes two inputs and returns three outputs. Note that the return value counts as one output.
S = svd(X);
U = svd(&S, &V, X);
U = svd(&S, &V, X, Zero);
U
, S
, V
, X
, and Zero
are all mwArray
objects.
![]() | Passing Optional Output Arguments | Passing Any Number of Inputs | ![]() |