how to include COM API in m scripts?

4 views (last 30 days)
Ghamdan Kaid
Ghamdan Kaid on 25 Mar 2020
Answered: Madheswaran on 23 Feb 2025
Hello,
I am trying to automate dSPACE Configuration desk. I need to find the way to include the dSPACE COM API into m scripts. your support is greatly appreciated.Thank you

Answers (1)

Madheswaran
Madheswaran on 23 Feb 2025
Hi Ghamdan,
You can use 'actxserver' to creates a local OLE Automation server, where 'progid' is the programmatic identifier (ProgID) of an OLE-compliant COM server, for your case it is 'dSPACE Configuration Desk'. The function returns a handle to the default interface of the server. Make sure MATLAB and dSPACE Configuration Desk are installed, and dSPACE Configuration Desk provides OLE Compliant COM interface.
Here's a simple example of how to create and release a COM server connection:
configdesk = actxserver('progid'); %Replace 'progid' with Program ID for dSPACE Configuration Desk
% ... Your automation tasks go here ...
delete(configdesk); % When done, release the COM server
To find the list of COM Server Program ID of all programs that provides COM interface and installed in your computer, refer to this answer: https://mathworks.com/matlabcentral/answers/126654-how-to-know-the-com-server-program-id-of-various-applications-to-use-in-matlab
For detailed information about the API methods and properties available to interact with dSPACE Configuration Desk through COM automation, please refer to the dSPACE Configuration Desk documentation.
For more information on how to use the COM Interfaces with MATLAB, refer to the following documentations:
  1. https://mathworks.com/help/matlab/using-com-objects-in-matlab.html
  2. https://mathworks.com/help/matlab/ref/com.html
Hope this helps!

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!