Read CAN signal from CANalyzer using COM object in MATLAB script

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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Wireless Communications에 대해 자세히 알아보기

제품

릴리스

R2016b

질문:

2021년 8월 19일

답변:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by