User`s guide
Utility Library Classes
Parameters.
Argument Type Description
pVar Variant
Variant
to be converted
Return Value. None.
Remarks. MATLAB handles dates as double-precision floating-point
numbers with 0.0 representing 0/0/00 00:00:00 (see “Data Conversion Rules”
on page B-2 for more information on conversion between MATLAB and
COM date values). By default, numeric dates that are output parameters
from co mpile d MATLAB functions are passed as
Doublesthatneedtobe
decremented by the COM date bias as well as coerced to COM dates. The
MWDate2VariantDate method performs this transformation and additionally
converts dates in string form to COM date types.
Example. This example uses
MWDate2VariantDate to process numeric dates
returned from a method compiled from the following MATLAB function:
function x = getdates(n, inc)
y = now;
for i=1:n
x(i,1) = y + (i-1)*inc;
end
This function produces an n-leng th column vector of numeric values
representing dates starting from the curre nt da te and tim e with each elem ent
incremented by
inc days. Assume that this function is included in a class
named
myclass that is included in a component named mycomponent with
a version of 1.0. The subroutine takes an Excel range and a
Double as
inputs and places the generated dates into the supplied range. If an error
occurs, a message box displays the error text. This function assumes that
MWInitApplication has b een previously called.
Sub GenDates(R As Range, inc As Double)
Dim aClass As Object
Dim aUtil As Object
On Error GoTo Handle_Error
Set aClass = CreateObject("mycomponent.myclass.1_0")
C-9