How to dynamically set message ID on CAN Pack block

조회 수: 6(최근 30일)
Thomas Akers
Thomas Akers 2016년 11월 13일
댓글: Birdman 2017년 10월 11일
I have a model simulating CAN traffic on a vehicle. As I morph the model to run on a Speedgoat, I need to process an array of CAN Messages of varying IDs at each time step. The messages and IDs vary with each time step. I currently collect all of the messages in an array of length (50,12) which holds up to 50 messages. Bytes 1:8 of each message(row) contains the message data and Bytes (9:12) contain the message ID.
The basic CAN Pack block statically sets the message ID and this would require many unique CAN Pack blocks to implement all the message traffic.
Alternately, is there documentation on how to create a CAN_MESSAGE object outside of the CAN Pack block?
Thanks in advance,


Hari Desanur
Hari Desanur 2016년 11월 16일
Hello Thomas,
You should be able to create a CAN_MESSAGE object outside the CAN Pack block using the canMessage function.
  댓글 수: 1
Birdman 2017년 10월 11일
How is this done? Please help!

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

Community Treasure Hunt

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

Start Hunting!

Translated by