External Interfaces/API    

MATLAB Automation Server Support

MATLAB on Microsoft Windows supports COM Automation server capabilities. Automation is a COM protocol that allows one application or component (the controller) to control another application or component (the server). Thus, MATLAB can be launched and controlled by any Windows program that can be an Automation Controller. Some examples of applications that can be Automation Controllers are Microsoft Excel, Microsoft Access, Microsoft Project, and many Visual Basic and Visual C++ programs. Using Automation, you can execute MATLAB commands, and get and put mxArrays from and to the MATLAB workspace.

To use MATLAB as an Automation server, follow steps 1 and 2:

  1. Invoke a COM Automation server.
  1. Consult the documentation of your controller to find out how to invoke a COM Automation server. The name of the MATLAB COM object that is placed in the registry is Matlab.Application. Exactly how you invoke the MATLAB server depends on which controller you choose, but all controllers require this name to identify the server.

  1. Use the Execute method on command strings.
  1. The Automation interface to MATLAB supports several methods. Here is a Visual Basic code fragment that invokes the MATLAB Automation Execute method, and that works in Microsoft Excel or any other Visual Basic or Visual Basic for Applications (VBA)-enabled application. The Execute method takes a command string as an argument and returns the results as a string. The command string can be any command that would normally be typed in the command window; the result contains any output that would have been printed to the command window as a result of executing the string, including errors:


  Using MATLAB as a DCOM Server Client MATLAB COM Automation Methods