Main Content

can.Database Properties

Properties of the can.Database object

Use the following properties to examine or configure CAN database settings. Use canDatabase to create a CAN database object.

can.Database

expand all

This property is read-only.

The Name property displays the name of the database, as a character vector value. This value is acquired from the database file name.

Data Types: char

This property is read-only.

The Path property displays the path of the database including the DBC file, as a character vector.

Data Types: char

This property is read-only.

The Nodes property stores the names of all nodes defined in the specified CAN database, as a cell array of character vectors. For example, to examine and index into the database nodes:

db  = canDatabase('CANex.dbc');
db.Nodes
3×1 cell array

    {'AerodynamicControl'        }
    {'Aftertreatment_1_GasIntake'}
    {'Aftertreatment_1_GasOutlet'}
db.Nodes{1}
'AerodynamicControl'

Data Types: cell

This property is read-only.

The NodeInfo property is a structure with information about all nodes defined in the specified CAN database. The NodeInfo property is a read-only structure. Use indexing to access the information of each node. For example:

db  = canDatabase('CANex.dbc');
db.NodeInfo
3×1 struct array with fields:

    Name
    Comment
    Attributes
    AttributeInfo
db.NodeInfo(1).Name
'AerodynamicControl'

Data Types: struct

This property is read-only.

The Messages property stores the names of all messages defined in the specified CAN database, as a cell array of character vectors.

db  = canDatabase('CANex.dbc');
db.Messages
3×1 cell array

    {'A1'     }
    {'A1DEFI' }
    {'A1DEFSI'}
db.Messages{1}
    'A1'

Data Types: cell

This property is read-only.

The MessageInfo property is a structure with information about all messages defined in the specified CAN database.

Use indexing to access the information of each message. For example:

db  = canDatabase('CANFDex.dbc');
db.MessageInfo
3×1 struct array with fields:

             Name: 'CANFDMessage'
     ProtocolMode: 'CAN FD'
          Comment: ''
               ID: 1
         Extended: 0
            J1939: []
           Length: 48
              DLC: 14
              BRS: 1
          Signals: {2×1 cell}
       SignalInfo: [2×1 struct]
          TxNodes: {0×1 cell}
       Attributes: {2×1 cell}
    AttributeInfo: [2×1 struct]
db.MessageInfo(1).Name
    'CANFDMessage'

Data Types: struct

This property is read-only.

The Attributes property stores the names of all attributes defined in the specified CAN database, as a cell array of character vectors.

Use indexing to access the information of each attribute. For example:

db  = canDatabase('CANex.dbc');
db.Attributes
3×1 cell array

    {'BusType'        }
    {'DatabaseVersion'}
    {'ProtocolType'   }
db.Attributes{1}
    'BusType'

Data Types: cell

This property is read-only.

The Attributeinfo property is a structure with information about all attributes defined in the specified CAN database.

Use indexing to access the information of each attribute.

db  = canDatabase('CANex.dbc');
db.AttributeInfo
3×1 struct array with fields:

    Name
    ObjectType
    DataType
    DefaultValue
    Value
db.AttributeInfo(1).Name
    'BusType'

Data Types: struct

Enter custom data to be stored in your CAN message or a J1939 parameter group, channel, or database object using the UserData property. When you save an object with UserData specified, you automatically save the custom data. When you load an object with UserData specified, you automatically load the custom data.

Tip

To avoid unexpected results when you save and load an object with UserData, specify your custom data in simple data types and constructs.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char | string | struct | table | cell | function_handle | categorical | datetime | duration | calendarDuration | fi
Complex Number Support: Yes

Version History

Introduced in R2009a