Receive messages from CAN bus
message = receive(canch,messagesrequested,'OutputFormat','timetable')
message = receive(canch,messagesrequested)
returns a timetable of CAN messages received on the CAN channel
message = receive(
canch. The number of messages returned is less than or equal
messagesrequested. If fewer messages are available than
messagesrequested specifies, the function returns the
currently available messages. If no messages are available, the function returns an
empty array. If
function returns all available messages.
To understand the elements of a message, refer to
'OutputFormat' option value of
'timetable' results in a timetable of messages. This is the
recommended output format for optimal performance and representation of CAN messages
You can receive CAN messages as a timetable or as an array of message objects.
Receive all available messages as a timetable.
canch = canChannel('Vector','CANCaseXL 1',1) start(canch) message = receive(canch,Inf,'OutputFormat','timetable')
Receive up to five messages as an array of message objects.
message = receive(canch,5)
canch— CAN channel
CAN channel, specified as a CAN channel object. This is the channel by which you access the CAN bus.
messagesrequested— Maximum number of messages to receive
Maximum number of messages to receive, specified as a positive numeric
message— CAN messages
CAN messages from the channel, returned as a timetable of messages or an array of CAN message objects.