I'm trying to read some data from CST Microwave Studio in MATLAB using CST's COM objects.
First, I got the project COM object's reference by executing
hApp = actxserver(ProgID);
hProj = hApp.OpenFile(ProjectFile);
At this point normally COM server returns signatures of all available methods of the COM-object by executing
MethSig = invoke(hProj);
It works well in e.g. MS Office programs, but it returns nothing for CST COM-objects... (Is it something to do with IDispatch interface not implemented in CST?)
Anyway, it is possible to call CST COM-object's methods by using the following syntax (taking the MethodName
and its arguments from the CST VBS documentation):
Out1 = hProj.invoke(MethodName, In1, In2, ...)
However, some methods return several output arguments, e.g. (again, from CST VBS documentation):
GetParameterCombination( string resultID, variant parameterNames, variant parameterValues ) bool
where resultID
is the input argument, and parameterNames
and parameterValues
are output arguments.
In a such case in other COM-enabled apps (like MS Office) MATLAB takes care of the output parameters splitting, and the following syntax would work:
[Out1, Out2, ...] = hWorkSheet.invoke(MethodName, In1, In2, ...);
% or even using dot-notation:
[Out1, Out2, ...] = hWorkSheet.MethodName(In1, In2, ...);
However, it doesn't work with CST:
[RetVal, parameterNames, parameterValues] = hProj.invoke('GetParameterCombination', '3D:RunID:1');
Error using Interface.CSTStudio_Application.Active3D/invoke
Error: Missing a required parameter
I have tried to pass the output arguments in similar ways as in this question, without any success, always getting the error:
Error using Interface.CSTStudio_Application.Active3D/invoke
Error: Type mismatch, argument 2
Is there any way to get all output variables from a COM-object in this case? A some sort of Java wrapper perhaps?
Thanks.