Why do I receive an error when trying to invoke a method on an object that has reference or
optional arguments?
Consider a COM object that has a method with following signature:
[id(1), helpstring("method AllinOne")] HRESULT AllinOne([in] double db, [out] BSTR* strout, [in, out] long* ln, [in,optional] BSTR strin, [out, optional] VARIANT* var, [out,retval] BOOL* bret);
This is the code I use in MATLAB:
h=actxserver('TestServer.ArgTest.1');[a,b,c,d] = invoke(h, 'AllinOne', 5.57, 10, 'test')
But MATLAB returns:
??? No method with matching signature.
As you can see, MATLAB incorrectly thinks the signature for the AllinOne method is as follows:
invoke(h) AllinOne = [int32, string, int32] AllinOne(handle, double, int32, Variant(Optional))
Best Answer