Main Content

canFDMessageTimetable

Convert CAN or CAN FD messages into timetable

Description

example

msgtimetable = canFDMessageTimetable(msg) creates a CAN FD message timetable from an existing CAN FD message timetable, an array of CAN message objects, or a CAN FD message structure from the CAN FD Log block. The output message timetable contains the raw message information (ID, Extended, Data, etc.) from the messages. If CAN message objects are input which contain decoded information, that decoding is retained in the CAN FD message timetable.

example

msgtimetable = canFDMessageTimetable(msg,database) uses the database to decode the message names and signals for the timetable along with the raw message information. Specify multiple databases in an array to decode message names and signals in the timetable within a single call.

The input msg can also be a timetable of data created by using read on an mdfDatastore object. In this case, the function converts the timetable of ASAM standard logging format data to a Vehicle Network Toolbox™ CAN FD message timetable.

Examples

collapse all

Convert log block output to a CAN FD message timetable.

 load LogBlockOutput.mat;
 db = canDatabase('myDatabase.dbc');
 msgTimetable = canFDMessageTimetable(canMsgs,db);

Convert an array of CAN message objects to a CAN FD message timetable.

msgTimetable = canFDMessageTimetable(canMsgs);

Decode an existing CAN FD message timetable with a database.

db = canDatabase('myDatabase.dbc')
msgTimetable = canFDMessageTimetable(msgTimetable,db)

The result is returned to the original timetable variable.

Convert an existing ASAM format message timetable, and decode using a database.

m = mdf('CANandCANFD.MF4');
db = canDatabase('CustomerDatabase.dbc');
mdfData = read(m);
msgTimetable = canFDMessageTimetable(mdfData{2},db);

Compare the two timetables.

mdfData{2}(1:4,1:6)
ans =

  4×6 timetable

       Time        CAN_DataFrame_BusChannel    CAN_DataFrame_FlagsEx    CAN_DataFrame_Dir    CAN_DataFrame_SingleWire    CAN_DataFrame_WakeUp    CAN_DataFrame_SRR
    ___________    ________________________    _____________________    _________________    ________________________    ____________________    _________________

    0.30022 sec               1                     2.1095e+06                  1                       0                         0                      0        
    0.45025 sec               1                     2.0972e+06                  1                       0                         0                      0        
    0.60022 sec               1                     2.1095e+06                  1                       0                         0                      0        
    0.75013 sec               1                     2.1095e+06                  1                       0                         0                      0        
msgTimetable(1:4,1:8)
ans =

  4×8 timetable

       Time         ID     Extended    Name    ProtocolMode        Data        Length    DLC      Signals   
    ___________    ____    ________    ____    ____________    ____________    ______    ___    ____________

    0.30022 sec     768     false       ''       'CAN FD'      [1×64 uint8]      64      15     [0×0 struct]
    0.45025 sec    1104     false       ''       'CAN'         [1×8  uint8]       8       8     [0×0 struct]
    0.60022 sec     768     false       ''       'CAN FD'      [1×64 uint8]      64      15     [0×0 struct]
    0.75013 sec    1872     false       ''       'CAN FD'      [1×24 uint8]      24      12     [0×0 struct]

Input Arguments

collapse all

Raw CAN messages, specified as one of the following:

  • Array of can.Message objects

  • Timetable of CAN FD messages

  • Timetable of ASAM MDF CAN FD messages

  • Struct of CAN FD messages from a CAN FD Log block

Example: canFDMessage()

CAN database, specified as a database object.

Example: database = canDatabase('CANDatabase.dbc')

Output Arguments

collapse all

CAN FD messages returned as a timetable.

Version History

Introduced in R2018b