Control NI multisim with COM from Matlab

조회 수: 12 (최근 30일)
Devon Lamp
Devon Lamp 2016년 3월 17일
댓글: Anvar V A 2020년 6월 14일
I am working with NI multisim and have an issue with a few of the commands using a COM interface. I can get it to connect and run certain commands but I have not been able to change values via matlab. This part of the code seems to work:
% Open interface to multisim
msim = actxserver('MultisimInterface.MultisimApp');
%conect
msim.Connect;
%set circuit
Circuit = msim.OpenFile('filename.ms13');
%request inputs from multisim
inputs = Circuit.EnumInputs('SimulationIOAll');
I can successfully request the value of resistor R1 from the circuit using this command:
Circuit.RLCValue('R1')
But I cannot change the value of R1 from matlab. For reference, within VB I can change the resistor value with this command
Circuit.RLCValue("R1") = 2
in matlab when I try the same command I get the following response:
No public field RLCValue exists for class
Interface.NI_Circuit_Design_Suite_Multisim_13.0.IMultisimCircuit.
I think this is because it is trying set an equality in matlab whereas in VB it seems to be sending this command to multisim somehow.
Any help is appreciated. The helpfile for this command is here http://zone.ni.com/reference/en-XX/help/375482A-01/multisim/rlcvalue/#wp270431 and the helpfile for the API is here http://zone.ni.com/reference/en-XX/help/375482A-01/TOC275.htm
  댓글 수: 2
Juan Serrano
Juan Serrano 2020년 3월 16일
Hi, what version of Matlab and MultiSim did you used? I've been tried to run the code:
% Open interface to multisim
msim = actxserver('MultisimInterface.MultisimApp');
But matlab show this error:
Error using feval
Server Creation Failed: Clase no registrada
Error in actxserver (line 86)
h=feval(['COM.' convertedProgID], 'server', machinename, interface);
Thank you!
Anvar V A
Anvar V A 2020년 6월 14일
After a long search I found the solution for connecting.
You need 32 bit Matlab software. Last 32 bit version of matlab is from 2015. so install 32 bit Matlab 2015 and then connect. It will work.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by