Read CAN signal from CANalyzer using COM object in MATLAB script

16 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Thomas Wagner
Thomas Wagner am 20 Aug. 2021
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.

Weitere Antworten (0)

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by