Masaki Suketa
2/3/2006 8:07:00 AM
Hello,
In message "WIN32OLE extension using in/out SAFEARRAYs (Matlab interface)"
on 06/02/02, "Ryan Hinton" <iobass@email.com> writes:
> I am having trouble calling a COM object (Matlab) using the excellent
> WIN32OLE Ruby extension. Several other calls have worked fine, but
> this call involves some in/out SAFEARRAYs. Here is the method
> signature.
>
> GetFullMatrix([in] BSTR varname, [in] BSTR workspace,
> [in, out] SAFEARRAY(double) *pr,
> [in, out] SAFEARRAY(double) *pi)
>
> The server uses the sizes of the arrays pr and pi to fill them with the
> requested data--hence their dual in/out nature. Does anyone know how
> to properly make a call like this? Is it possible? My most successful
> attempts have given me the following error.
I do not have MATLAB, But I read the web document about MATLAB(Japanese).
And the article discribes Matlab provides GetWorkspaceData for VBScript.
Because VBScript does not support SAFEARRAY and you can not use
GetFullMatrix in VBScript.
Win32OLE may be same as VBScript because Win32OLE
calls GetFullMatrix with VT_VARIANT|VT_BYREF or VT_ARRAY(SAFEARRAY).
But MATLAB expect VT_ARRAY|VT_BYREF (SAFEARRAY *).
So you get Type mysmatch error.
> t3 = matlab.GetFullMatrix('bob', 'base', t1, t2)
Could you try GetWorkspaceData instead?
Sorry, but I do not know how to use GetWorkspaceData exactly.
Regards,
Masaki Suketa