Selecting Version for COM server

11 ビュー (過去 30 日間)
Matthew
Matthew 2012 年 9 月 25 日
コメント済み: edurayman 2016 年 3 月 11 日
Is there a way to select which version of a program an activex server should start up?
For instance for Matlab, if I want to get 2010b is there a way I can
h = actxserver('matlab.application','version','7.11.0.584');
even if I have 2 or more different versions of Matlab installed?
  1 件のコメント
edurayman
edurayman 2016 年 3 月 11 日
This is an old thread, but I was trying to figure this today and actually found a solution. According to the documentation (<http://www.mathworks.com/help/matlab/matlab_external/introduction_brd0vd4-1.html)>:
"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)."
That totally does the work for me. In my case, I have Matlab R2014a and R2015b. I can switch back and forth between the two by using:
matlab = new ActiveXComponent('Matlab.Application.8.3'); % for R2014a
matlab = new ActiveXComponent('Matlab.Application.8.6'); % for R2015b
Alternatively, if you want to select a specific Matlab version by default, you can just type-in regmatlabserver in your selected Matlab version command window (<http://www.mathworks.com/help/matlab/ref/regmatlabserver.html)>.
Hope this helps anyone who is looking into the same issue.

サインインしてコメントする。

採用された回答

Sachin Ganjare
Sachin Ganjare 2012 年 9 月 26 日
According to the matlab documentation:
"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)."
Hence I believe you cannot control the version of Matlab which will be executed.
But there is one way with which you can always invoke most recent version of matlab i.e. to use "Matlab.Autoserver" as progid.
Hope this helps!!!
  3 件のコメント
Arvind Pandey
Arvind Pandey 2013 年 1 月 6 日
"Matlab.Autoserver" helps me in one of my application when we have two Matlab version where one is 6.1 & other is 2006b. But this command did not solve the same issue when We have two matlab version where one is 6.1 & other is 2011b. Please suggest if there is any command which works for all the Matlab version to invoke the Default Matlab Version?
Walter Roberson
Walter Roberson 2013 年 1 月 6 日
No there is not, Arvind. Some MATLAB versions predate the existence of ActiveX technology (1996), so there is no command which works for all MATLAB versions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeActiveX についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by