User`s guide
Utility Library Classes
Sub MWPack(pVarArg, [Var0], [Var1], ... ,[Var31])
Packs a variable length list of Variant argum ents into a single Variant
array. Th is function is typically used for creating a varargin cell from a list
of separate inputs. Each input in the list is added to the array only if it is
nonempty and nonmissing. (In Visual Basic, a missing parameter is denoted
by a
Variant type of vbError with a value of &H80020004.)
Parameters.
Argument Type Description
pVarArg Variant
Receives the resulting
array
[Var0], [Var1], ... Variant
Optional list of
Variantstopack
into the array. 0 to
32 arguments can be
passed.
Return Value. None.
Remarks. This function always frees the contents of
pVarArg before
processing the list.
Example. This example uses
MWPack in a formula function to produce a
varargin cell to pass as an input parameter to a method compiled from a
MATLAB function with the signature:
function y = mysum(varargin)
y = sum([varargin{:}]);
The function returns the sum of the elements in varargin. Assume that this
function is a method of a class named
myclass that is included in a component
named
mycomponent with a version of 1.0. The Visual Basic function allow s
up to 10 inputs, and returns the result
y. If an error occurs, the function
returns the error string. This function assumes that
MWInitApplication
has been previously called.
Function mysum(Optional V0 As Variant, _
Optional V1 As Variant, _
C-5