Products & Services Solutions Academia Support User Community Company

Learn more about Vehicle Network Toolbox   

Other Uses of the CAN Database

Viewing Messages Information in the CAN Database

You can get information about the definition of messages in the database, a single message by name, or a single message by ID. To get message information about all messages in the database, type:

msgInfo = messageInfo(database name)

This command returns the message structure of information about messages in the database. For example:

msgInfo = 

5x1 struct array with fields:
    Name
    Comment
    ID
    Extended
    Length
    Signals

To get information about a single message by message name, type:

msgInfo = messageInfo(database name, 'message name')

This command returns information about the message as defined in the database. For example:

msgInfo = messageInfo(db, 'EngineMsg')

msgInfo = 

        Name: 'EngineMsg'
     Comment: ''
          ID: 100
    Extended: 0
      Length: 8
     Signals: {2x1 cell}

Here the function returns information about message with name EngineMsg in the database db. You can also use the message ID to get information about a message. For example, to view the example message given here by inputting the message ID, type:

msgInfo = messageInfo(db, 100, false)

This command provides the database name, the message ID, and a Boolean value for the extended value of the ID.

To learn how to use it and work with the database, see messageInfo function.

Viewing Signal Information in a CAN Message

You can get information about all signals in a CAN message. Provide the message name or the ID as a parameter in the command:

sigInfo = signalInfo(db, 'EngineMsg')

You can also get information about a specific signal by providing the signal name:

sigInfo = signalInfo(db, 'EngineMsg', 'EngineRPM')

To learn how to use this property and work with the database, see the signalInfo function.

Attaching a CAN Database to Existing Messages

You can attach a .dbc file to messages and apply the message definition defined in the database. Attaching a database allows you to view the messages in their physical form and use a signal-based interaction with the message data. To attach a database to a message, type:

 attachDatabase(message name, database name)

You can also dissociate a message from a database so that you can view the message in its raw form. To clear the attached database from a message, type:

 attachDatabase(message name, [])

For more information, see the attachDatabase function.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS