Using extractAll command
显示 更早的评论
I am building a script that configures a CAN channel and then listens for and extracts a certain type of message from the traffic on the CAN. However, I am having problems with the extractAll command because it doesn't like the class of any of the arguements that I pass to it. I've tried sending it a double, single, char, and struct but it won't take any of them. Does anyone out there have the same problem? Here is my current script:
%% Create CAN channel, configure properties and initialize variables
canch = canChannel('Vector','CANcaseXL 1', 1);
configBusSpeed(canch, 500000);
msg_num = 100;
message.id = 415;
message.messagename = 'IC_A1';
%% Start the CAN channel and receive messages
for i = 1:msg_num
start(canch)
receive(canch,i);
[msgOut, remainder] = extractAll(message, 415, true);
value = unpack(message, 0, 16, 'LittlegEndian', 'int16');
end
%% Stop the CAN channel
stop(canch)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Vehicle Network Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!