Skill v1.0.1
currentAutomated scan100/100+9 new
version: "1.0.1" name: matlab-import-vehicle-data description: Use when importing vehicle data from log files (MDF/MF4/DAT, BLF, ASC/TXT), decoding CAN/CAN FD/LIN messages to signals via DBC, ARXML, or LDF databases, or calling blfread, blfinfo, mdfRead, canSignalImport, canMessageImport, canMessageTimetable, canFDMessageTimetable, canSignalTimetable, or linMessageTimetable. license: MathWorks BSD-3-Clause metadata: author: MathWorks version: "1.1" disable-model-invocation: false allowed-tools: mcp__matlab__detect_matlab_toolboxes, mcp__matlab__evaluate_matlab_code, mcp__matlab__check_matlab_code, mcp__matlab__run_matlab_file, mcp__matlab__run_matlab_test_file
Import and Decode Vehicle Data
Import and decode vehicle network log files in MATLAB using Vehicle Network Toolbox (VNT).
When to Use
- Reading
.mf4/.mdf/.dat,.blf,.asc, or.txtvehicle bus log files - Decoding raw CAN/CAN FD frames to signals via DBC or ARXML databases
- Decoding LIN frames via LDF databases (R2025a+)
- Handling polymorphic return types from VNT read functions
When Not To Use
- Simulink CAN configuration
- Live CAN channel access
- XCP/A2L workflows
Prerequisites
Before calling BLF/ASC/TXT import or CAN/CAN FD/LIN decode functions, call detect_matlab_toolboxes to confirm Vehicle Network Toolbox is installed. If unavailable, tell the user. Once confirmed in a session, do not re-check.
MDF functions (mdfRead, mdfChannelGroupInfo, mdfInfo, mdfChannelInfo) are base MATLAB (R2023a+) and do not require VNT. Do not use the deprecated mdf() object constructor -- always use the functional API. For reading all groups blindly, mdfRead alone is acceptable. To selectively read or inspect structure first, use mdfChannelGroupInfo or mdfInfo.
Decode Pipeline
| Source Format | CAN | CAN FD | LIN | Raw (no decode) | |
|---|---|---|---|---|---|
| ASC | canSignalImport(f,"Vector",db) | same | -- | canMessageImport(f,"Vector",OutputFormat="timetable") | |
| TXT | canSignalImport(f,"Kvaser",db) | same | -- | canMessageImport(f,"Kvaser",OutputFormat="timetable") | |
| BLF | blfread(f,Database=db) -> canSignalTimetable | blfread(f,Database=db) -> canFDMessageTimetable -> canSignalTimetable | blfread(f,Database=linDb,ProtocolMode="LIN") -> linMessageTimetable | blfread(f) | |
| MDF/MF4/DAT | mdfRead -> canMessageTimetable(tt,db) -> canSignalTimetable | mdfRead -> canFDMessageTimetable(tt,db) -> canSignalTimetable | mdfRead -> linMessageTimetable(tt,linDb) | mdfRead -> timetable directly |
Database Loading
db = canDatabase("path/to/file.dbc"); % CAN and CAN FDdb = arxmlDatabase("path/to/file.arxml"); % CAN only (not CAN FD)linDb = linDatabase("path/to/file.ldf"); % LIN (R2025a+)
Load once, pass to all decode calls. Multiple databases: canMessageTimetable(tt, [db1, db2]).
Key Constraints
- Polymorphic returns: All VNT read functions (
canSignalImport,blfread,mdfRead,canMessageImport) return different types based on channel count and parameters. Always guard withiscell()/istimetable()/isstruct(). When checking multi-channel results, useiscell()as the primary guard to branch between cell array (multi-channel) vs direct timetable (single channel), then iterate or extract with{n}or{i}. - ARXML + CAN FD:
arxmlDatabasedoes not support CAN FD in MATLAB. It cannot be used withcanFDMessageTimetable. When the user provides an ARXML file for CAN FD data, always explain that ARXML does not support CAN FD and they must usecanDatabasewith a DBC file instead. Do not silently switch to DBC without explaining why. - No `canFDSignalTimetable`: This function does not exist. Use
canSignalTimetablefor both CAN and CAN FD signals. - BLF LIN requires `ProtocolMode="LIN"`: Without it,
blfreadreturns only CAN data. - No signal-level LIN decode: Only
linMessageTimetableexists. Access signal values from timetable columns directly. - MDF raw CAN detection: Use channel name prefixes
CAN_DataFrame/LIN_Frame(ASAM standard). Do not useSourceBusTypemetadata -- it is vendor-specific and unreliable. - `canMessageImport` default format: Returns legacy
can.Messagearray. Always passOutputFormat="timetable". - Cell extraction: Multi-channel calls to
blfread,mdfRead, andcanMessageImportreturn cell arrays. Extract with{n}before processing. - Use `canSignalImport` for ASC/TXT signals: It decodes in one call. Only use
canMessageImportwhen raw message timetables are needed.
File-Specific References
- ASC import --
canSignalImport/canMessageImportwith Vector and Kvaser vendors, polymorphic return type handling for multi-channel files - BLF import --
blfinfofor file inspection,blfreadwith and without ChannelID, CAN vs LIN protocol selection - MDF import --
mdfRead/mdfChannelGroupInfo/mdfChannelInfo, detecting raw CAN/LIN groups by channel name, reading specific groups
Protocol References
- CAN decode --
canMessageTimetableandcanSignalTimetablepipelines, DBC and ARXML database usage - CAN FD decode --
canFDMessageTimetablepipeline, why ARXML does not work for CAN FD - LIN decode --
linMessageTimetableusage, accessing signal values from timetable columns (no signal-level function exists) - Database objects --
canDatabasevsarxmlDatabasevslinDatabase, which decode functions accept which database type
Copyright 2026 The MathWorks, Inc.