This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

canMessageTimetable

Convert CAN messages into timetable

Syntax

msgtimetable = canMessageTimetable(msg)
msgtimetable = canMessageTimetable(msg,database)

Description

example

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 read on an mdf object. In this case, the function converts the timetable of ASAM standard logging format data to a Vehicle Network Toolbox™ CAN message timetable.

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.

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

Compare the two timetables.

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

  4×6 timetable

        Time        CAN_DataFrame_DataLength    CAN_DataFrame_WakeUp    CAN_DataFrame_SingleWire    CAN_DataFrame_IDE    CAN_DataFrame_ID    CAN_DataFrame_Flags
    ____________    ________________________    ____________________    ________________________    _________________    ________________    ___________________

    0.019968 sec               4                         0                         0                        0                  100                    0         
    0.029964 sec               4                         0                         0                        0                  100                    0         
    0.039943 sec               4                         0                         0                        0                  100                    0         
    0.049949 sec               4                         0                         0                        0                  100                    0         

msgTimetable(1:4,1:6)
ans =

  4×6 timetable

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

    0.019968 sec    100     false       ''     [1×4 uint8]      4       [0×0 struct]
    0.029964 sec    100     false       ''     [1×4 uint8]      4       [0×0 struct]
    0.039943 sec    100     false       ''     [1×4 uint8]      4       [0×0 struct]
    0.049949 sec    100     false       ''     [1×4 uint8]      4       [0×0 struct]

Input Arguments

collapse all

CAN message data, specified as a CAN message timetable, an array of CAN message objects, or a CAN message structure from the CAN log block.

CAN database, specified as a database handle.

Output Arguments

collapse all

CAN messages returned as a timetable.

See Also

Functions

Introduced in R2017a