Documentation Center

  • Trial Software
  • Product Updates


Build CAN message based on user-specified structure


message = canMessage(id, extended, datalength)
message = canMessage(database, messagename)


message = canMessage(id, extended, datalength) creates and returns a CAN message object, from the raw message information.

message = canMessage(database, messagename) constructs a message using the message definition of the specified message, in the specified database.

Input Arguments


The ID of the message that you specify.


Indicates whether the message ID is of standard or extended type. The Boolean value is true if extended or false if standard.


The length of the data of the message, in bytes. Specify from 0 through 8.


Handle to the CAN database containing the message definition.


The name of the message definition in the database.

Output Arguments


The message object returned from the function.


DataSet CAN message data
DatabaseStore CAN database information
ErrorCAN message error frame
ExtendedIdentifier type for CAN message
IDIdentifier for CAN message
Name (Message)CAN message name
RemoteSpecify CAN message remote frame
SignalsDisplay physical signals defined in CAN message
TimestampDisplay message received timestamp
UserDataEnter custom data


To construct a CAN message, type:

 message = canMessage(2500, true, 4)

To construct a message using CAN database message definitions, create a database object using the canDatabase function, and then construct your message:

candb = canDatabase('c:\database.dbc')
message = canMessage (candb, 'messagename')

See Also

| | | | | |

Was this topic helpful?