Read CAN signal from CANalyzer using COM object in MATLAB script

16 次查看(过去 30 天)
Hello,
I want to remote control a CANalyzer measurement with a MATLAB script via COM objects and stock while trying to get signals from CAN.
What I already have (working):
CANalyzer = actxserver('CANalyzer.Application');
CANalyzer.Open('someCANalyzerConfig.cfg');
CANalyzer.Measurement.Start;
Technical References from Vector says, that "Signal" is part of "Bus" which is part of "Application". So I type in the command window
CANalyzer.Bus
and the answer is
0×0 empty char array
I also tried to use the method from the .m-script from MathWorks Support Team by typing
simSetup = CANalyzer.Configuration.SimulationSetup;
buses = simSetup.buses; % Default bus = CAN.
bus = buses.Item(1); % Get bus object.
signal = bus.GetSignal(1,'ACU_Send_Signals_4','ACU_Bass_St');
disp(signal.Value)
but there is already a error message in the first line:
Invoke Error, Dispatch Exception: Nicht implementiert
Does anyone has an idea, how to solve this invoke error?
It seams as some objects are not present on the interface.
A simple .vbs-script with the 3 lines
Set App = CreateObject("CANalyzer.Application")
Set EngSpeed = App.Bus.GetSignal(1, "Engine", "EngSpeed")
MsgBox "The current value is " & EngSpeed.Value, vbSystemModal
is doing the job perfectly and shows me the actual value of the specific CAN signal.

采纳的回答

Thomas Wagner
Thomas Wagner 2021-8-20
Vector support could answer me the question after some correspondence. The trick is the declaration of the "bus":
bus = get(CANalyzer, 'Bus', 'CAN');
instead of
bus = CANalyzer.Bus;
I hope this answer helps, if you have similar problems.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Use COM Objects in MATLAB 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by