MATLAB: How to get the class ProgID or a class of an ActiveX object that is created in MATLAB

activexclassisaMATLABprogidtype

How do I get the class ProgID or a class of an ActiveX object that is created in MATLAB?
Can the CLASS function or the ISA function distinguish the type of the ActiveX object?

Best Answer

The CLASS function in MATLAB 6.5 (R13) will give the class ProgID of an ActiveX object that is created in MATLAB. For example:
h = actxserver('Excel.Application');
class(h)
ans =
COM.excel.application
As a workaround for previous versions, you can use the readable properties of the ActiveX object in MATLAB in a conditional statement. For example:
h = actxserver('Excel.Application')
if(strcmp(h.Name, 'Microsoft Excel"))
%code here
You can pass the GET command the handle to the ActiveX object in order to see all its properties and methods.
For example the following code will yield a list of all the properties and methods available for that object. You can then experiment and look for a property that you may be able to use to uniquely identify the object.
h = actxserver('Excel.Application')
get(h)