MATLAB COM 接口参数

COM Server Types

  • Automation — A server that supports the OLE Automation standard. Automation servers are based on the IDispatch interface. Clients of all types, including scripting clients, access Automation servers.

  • Custom — A server that implements an interface directly derived from IUnknown. MATLAB® does not support custom interfaces.

  • Dual — A server that implements a combination of Automation and Custom interfaces.

Programmatic Identifiers

To create an instance of a COM object, you use its programmatic identifier, or ProgID. The ProgID is a unique string defined by the component vendor to identify the COM object. You obtain a ProgID from your vendor documentation.

The MATLAB ProgIDs for shared servers are:

  • Matlab.Application — Starts a command window Automation server with the version of MATLAB that was most recently used as an Automation server (might not be the latest installed version of MATLAB).

  • Matlab.Autoserver — Starts a command window Automation server using the most recent version of MATLAB.

  • Matlab.Desktop.Application — Starts the full desktop MATLAB as an Automation server using the most recent version of MATLAB.

The ProgIDs for dedicated servers are:

  • Matlab.Application.Single

  • Matlab.Autoserver.Single

These version-independent MATLAB ProgIDs specify the currently installed and registered version of MATLAB.

In order to create an instance of a specific installed and registered MATLAB version, you can use a version-dependent ProgID. For example, using the ProgID Matlab.Application.7.14 creates an instance of MATLAB version 7.14 (R2012a).

Shared and Dedicated Servers

You can start the MATLAB Automation server in one of two modes – shared or dedicated. A dedicated server is dedicated to a single client; a shared server is shared by multiple clients. The mode is determined by the programmatic identifier (ProgID) used by the client to start MATLAB. If you use matlab.application as your ProgID, then MATLAB creates a shared server.

Starting a Shared Server

The ProgID, matlab.application, specifies the default mode, which is shared. You can also use the version-specific ProgID, matlab.application.N.M, where N is the major version and M is the minor version of your MATLAB. For example, use N = 7 and M = 4 for MATLAB version 7.4.

Once MATLAB is started as a shared server, all clients that request a connection to MATLAB using the shared server ProgID connect to the already running instance of MATLAB. In other words, there is never more than one instance of a shared server running, since it is shared by all clients that use the shared server ProgID.

Starting a Dedicated Server

To specify a dedicated server, use the ProgID, matlab.application.single, (or the version-specific ProgID, matlab.application.single.N.M).

Each client that requests a connection to MATLAB using a dedicated ProgID creates a separate instance of MATLAB; it also requests the server not be shared with any other client. Therefore, there can be several instances of a dedicated server running simultaneously, since the dedicated server is not shared by multiple clients.

In-Process and Out-of-Process Servers

MATLAB supports the following server configurations.

In-Process Server

An in-process server is a component implemented as a dynamic link library (DLL) or ActiveX® control that runs in the same process as the client application, sharing address space. Communication between client and server is relatively fast and simple.

Local Out-of-Process Server

A local out-of-process server is a component implemented as an executable (EXE) file that runs in a separate process from the client application. The client and server processes are on the same computer system. This configuration is slower due to the overhead required when transferring data across process boundaries.

Remote Out-of-Process Server

Distributed Component Object Model (DCOM) is a protocol that allows COM connections to be established over a network. If you are using a version of the Windows® operating system that supports DCOM and a controller that supports DCOM, then you can use the controller to start a MATLAB server on a remote machine. DCOM must be configured properly, and MATLAB must be installed on each machine that is used as a client or server. Even though the client machine might not run MATLAB in such a configuration, the client machine must have a MATLAB installation because certain MATLAB components are required to establish the remote connection. Consult your DCOM documentation for how to configure DCOM for your environment.

Network communications, in addition to the overhead required for data transfer, can make this configuration slower than the local out-of-process configuration.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值