User`s guide

Vehicle Network Communication Examples
1-21
1
Use the pack function to pack your message with these input parameters:
pack(messageout, 25, 0, 16, 'LittleEndian')
Here you are specifying the data value to be 25, the start bit to be 0, the signal size
to be 16, and the byte order to be little-endian format.
2
To see the packed data, type:
messageout
MATLAB displays your message properties with the specified data:
messageout =
can.Message handle
Package: can
Properties:
ID: 500
Extended: 0
Name: ''
Database: []
Error: 0
Remote: 0
Timestamp: 0
Data: [25 0 0 0 0 0 0 0]
Signals: []
Methods, Events, Superclasses
The only field that changes after you specify the data is Data. Refer to the pack function
to understand more about the input arguments.
Transmit a Message
After you define the message and pack it with the required data, you are ready to
transmit the message. For this example, use canch to transmit the message.
1
Use the transmit function to transmit the message, supplying the channel and the
message as input arguments:
transmit(canch1, messageout)
2
To display the channel status, type: