C Math Library Reference | ![]() ![]() |
Build a list of output arguments, some of which are indexed expressions
C Prototype
mlfVarargoutList *mlfIndexVarargout(mxArray **ppa, ...);
Arguments
mxArray **ppa
A pointer to a pointer to an array.
Return
A cell array containing the output arguments.
Description
Constructs a varargout list with index expressions for one or more outputs. Note that this function MUST be called as an input argument for the automatic memory management to work properly. Its result should not be saved in a variable. A null or empty string means there's no index for the output argument. Increments nargout by the number of outputs in the current index expression.When the variable varargout
appears as the last output argument in the definition of a MATLAB function, that function can return any number of outputs, starting at that position in the argument list.
If you are indexing into any of the arrays that you pass as varargout
output arguments, you must use mlfIndexVarargout()
to form the varargout
list. For indexed arguments, you specify the a pointer to the source array pointer, the index format string, and the index values, just as you would with the mlfIndexRef()
routine. For nonindexed arguments, you specify the array argument paired with a NULL
argument.
Example
In this example, output arguments z
and n
are indexed expressions. Note the similarity to mlfIndexRef()
syntax. Because argument m
is nonindexed, you follow it with a NULL
argument to indicate that there is no associated indexing syntax with this argument.
mxArray *x = NULL, *y = NULL, *z = NULL, *m = NULL, *n = NULL; mlfAssign(&x, mlfVarargout_Function(&y, mlfIndexVarargout(&z, "(?)", mlfScalar(1), &m, NULL, &n, "{?}", mlfCreateColonIndex(), NULL), a, b)));
See Also
mlfVarargout
, mlfIndexRef
, mlfIndexAssign
![]() | mlfIndexRef | mlfPrintf | ![]() |