Main Content

Explore COM Objects

A COM object has properties, methods, events, and interfaces. Your vendor documentation describes these features, but you can also learn about your object using MATLAB® commands.


A property is information that is associated with a COM object. To see a list of properties of an object, use the get function. Alternatively, use the MATLAB Property Inspector, a user interface to display and modify properties. For example, to list all properties of a Microsoft® Excel® object type the following command. MATLAB displays the properties for your Excel version.

myApp = actxserver('Excel.Application');

To display a single property, type the following. MATLAB displays the value for your application.

ans =

MathWorks, Inc.

To open the Property Inspector, choose one of the following. MATLAB opens the Inspector window.

  • Call the inspect function from the MATLAB command line:

  • Double-click the myApp object in the MATLAB Workspace browser.

Scroll down until you see the OrganizationName property, the same value returned by the get function.


A method is a procedure you call to perform a specific action on the COM object. For example, to list all methods supported by the Excel object, type the following. MATLAB opens a window showing the method signatures for COM.Excel_Application objects.

myApp = actxserver('Excel.Application');


An event is typically a user-initiated action that takes place in a server application, which often requires a reaction from the client. For example, clicking the mouse at a particular location in a server interface window might require the client to respond. When an event is fired, the server communicates this occurrence to the client. If the client is listening for this particular type of event, it responds by executing a routine called an event handler.

Use the events function to list all events known to the server and use the eventlisteners function to list registered events.

For example, to list the events for the Microsoft Internet Explorer® web browser, type the following. MATLAB displays the events for your Internet Explorer version.

myNet = actxserver('internetexplorer.application');

To see which events have event handlers, type:

ans = 

An empty result means that no events are registered.


An interface is a set of related functions used to access the data of a COM object. When you create a COM object using the actxserver function, MATLAB returns a handle to an interface. Use the get and interfaces functions to see other interfaces implemented by your object.

For example, to see interfaces of an Excel object, type:

e = actxserver('Excel.Application');

MATLAB displays the properties, including interfaces, for your Excel version. For example, Workbooks is an interface.

ans =

To explore the Workbooks interface, create a workbooks object and use the relevant MATLAB commands.

w = e.Workbooks;

Identify Objects and Interfaces



Return the class of an object.


Determine if an object is of a given MATLAB class.


Determine if the input is a COM object.


Determine if an item is an event of a COM object.


Determine if an item is a method of a COM object.


Determine if an item is a property of a COM object.


Determine if the input is a COM interface.

See Also

| | | |

Related Topics