Main Content

canMessageTimetable

Convert CAN messages into timetable

Description

msgtimetable = canMessageTimetable(msg) creates a CAN message timetable from existing raw messages. 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 message timetable. A timetable of CAN message data can often provide better performance than using CAN message objects.

example

msgtimetable = canMessageTimetable(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 mdfRead on an MDF file. In this case, the function converts the timetable of ASAM standard logging format data to a Vehicle Network Toolbox™ CAN message timetable.

example

Examples

collapse all

Convert log block output to a CAN message timetable.

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

Convert legacy CAN message objects to a CAN message timetable.

msgTimetable = canMessageTimetable(canMsgs);

Decode an existing CAN message timetable with a database.

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

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

db = canDatabase('dbFiles\dGenericVehicle.dbc');
mdfData = mdfRead('mdfFiles\CANonly.MF4');
msgTimetable = canMessageTimetable(mdfData{1},db);

Compare the two timetables.

 mdfData{1}
ans =

  795×9 timetable with 0 events

             t          CAN_DataFrame.DataLength    CAN_DataFrame.WakeUp    CAN_DataFrame.SingleWire    CAN_DataFrame.IDE    CAN_DataFrame.ID    CAN_DataFrame.Flags    CAN_DataFrame.DLC    CAN_DataFrame.DataBytes    CAN_DataFrame.BusChannel
        ____________    ________________________    ____________________    ________________________    _________________    ________________    ___________________    _________________    _______________________    ________________________

        0.019968 sec               4                         0                         0                        0                  100                    0                     4                 {[100 0 0 0]}                    1            
        0.029964 sec               4                         0                         0                        0                  100                    0                     4                 {[108 0 0 0]}                    1            
        0.039943 sec               4                         0                         0                        0                  100                    0                     4                 {[116 0 0 0]}                    1            
        0.049949 sec               4                         0                         0                        0                  100                    0                     4                 {[124 0 0 0]}                    1            
        0.059945 sec               4                         0                         0                        0                  100                    0                     4                 {[132 0 0 0]}                    1            
        0.070001 sec               4                         0                         0                        0                  100                    0                     4                 {[140 0 0 0]}                    1            

             :                     :                         :                         :                        :                   :                     :                     :                       :                          :            

        7.9003 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 44 3 0 0]}                    1            
        7.9204 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 52 3 0 0]}                    1            
        7.9303 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 60 3 0 0]}                    1            
        7.9305 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 68 3 0 0]}                    1            
        7.9404 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 76 3 0 0]}                    1            
        7.9604 sec                 4                         0                         0                        0                  100                    0                     4                 {[ 84 3 0 0]}                    1            
msgTimetable
msgTimetable =

  795×8 timetable

        Time        ID     Extended       Name           Data         Length      Signals       Error    Remote
    ____________    ___    ________    __________    _____________    ______    ____________    _____    ______

    0.019968 sec    100     false      {0×0 char}    {[100 0 0 0]}      4       {0×0 struct}    false    false 
    0.029964 sec    100     false      {0×0 char}    {[108 0 0 0]}      4       {0×0 struct}    false    false 
    0.039943 sec    100     false      {0×0 char}    {[116 0 0 0]}      4       {0×0 struct}    false    false 
    0.049949 sec    100     false      {0×0 char}    {[124 0 0 0]}      4       {0×0 struct}    false    false 
    0.059945 sec    100     false      {0×0 char}    {[132 0 0 0]}      4       {0×0 struct}    false    false 
    0.070001 sec    100     false      {0×0 char}    {[140 0 0 0]}      4       {0×0 struct}    false    false 

         :           :        :            :               :            :            :            :        :   

    7.9003 sec      100     false      {0×0 char}    {[ 44 3 0 0]}      4       {0×0 struct}    false    false 
    7.9204 sec      100     false      {0×0 char}    {[ 52 3 0 0]}      4       {0×0 struct}    false    false 
    7.9303 sec      100     false      {0×0 char}    {[ 60 3 0 0]}      4       {0×0 struct}    false    false 
    7.9305 sec      100     false      {0×0 char}    {[ 68 3 0 0]}      4       {0×0 struct}    false    false 
    7.9404 sec      100     false      {0×0 char}    {[ 76 3 0 0]}      4       {0×0 struct}    false    false 
    7.9604 sec      100     false      {0×0 char}    {[ 84 3 0 0]}      4       {0×0 struct}    false    false 

Input Arguments

collapse all

CAN message data, specified as one of the following:

  • Array of can.Message objects

  • Timetable of CAN messages

  • Timetable of ASAM MDF CAN messages

  • Struct of CAN messages from a CAN Log block

CAN database, specified as a database handle.

Output Arguments

collapse all

CAN messages returned as a timetable.

Version History

Introduced in R2017a