Main Content

canSignalImport

Import CAN log file into decoded signal timetables

Description

sigtimetable = canSignalImport(file,vendor,database) imports a CAN message log file from the specified vendor directly into decoded signal value timetables using the provided database. The function returns a structure with a field for each unique message in the timetable. Each field value is a timetable of all the signals in all instances of that message. Use this form of syntax to convert an entire set of messages in a single function call.

example

sigtimetable = canSignalImport(file,vendor,database,msgnames) returns signal timetables for only the messages specified by msgnames, which can specify one or more message names. Use this syntax form to import signals from only a subset of messages.

sigtimetable = canSignalImport(___,ChannelID=chanID) returns data for only the specified channel, chanID. By default, all channels are returned.

example

Examples

collapse all

Create signal timetables from all messages in a log file.

db = canDatabase('MyDatabase.dbc');
sigtimetable = canSignalImport('MsgLog.asc','Vector',db);

Create signal timetables from specified messages in a log file.

db = canDatabase('MyDatabase.dbc');
sigtimetable1 = canSignalImport('MsgLog.asc','Vector',db,'Message1');
sigtimetable2 = canSignalImport('MsgLog.asc','Vector',db,{'Message1','Message2'});

Input Arguments

collapse all

CAN message log file, specified as a character vector or string.

Example: 'MsgLog.asc'

Data Types: char | string

Vendor file format, specified as a character vector or string. The supported file formats are those defined by Vector and Kvaser.

Example: 'Vector'

Data Types: char | string

CAN database, specified as a database handle.

Message names, specified as a character vector, string, or array.

Example: 'message1'

Data Types: char | string | cell

Channel ID, specified as a numeric scalar value, indicating which channel data to import from the log file. If not specified, all channels are read. When importing only one channel, the function returns a structure. When importing multiple channels, the function returns a cell array of structures, with one element per channel.

Example: 2

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

CAN signals, returned as a structure. The structure field names correspond to the messages of the input, and each field value is a timetable of CAN signals. When importing multiple channels, the output is a cell array of structures.

Data Types: struct

Version History

Introduced in R2017a

expand all