matlab-import-vehicle-data

$npx mdskill add matlab/matlab-agentic-toolkit/matlab-import-vehicle-data

Import and decode vehicle network log files in MATLAB.

  • Reads MDF, BLF, ASC, or TXT vehicle bus log files.
  • Depends on Vehicle Network Toolbox and base MATLAB MDF functions.
  • Checks for required toolboxes before calling import functions.
  • Returns decoded CAN, CAN FD, or LIN signal timetables.

SKILL.md

.github/skills/matlab-import-vehicle-dataView on GitHub ↗
---
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 `.txt` vehicle 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

```matlab
db = canDatabase("path/to/file.dbc");       % CAN and CAN FD
db = 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 with `iscell()`/`istimetable()`/`isstruct()`. When checking multi-channel results, use `iscell()` 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:** `arxmlDatabase` does not support CAN FD in MATLAB. It cannot be used with `canFDMessageTimetable`. When the user provides an ARXML file for CAN FD data, always explain that ARXML does not support CAN FD and they must use `canDatabase` with a DBC file instead. Do not silently switch to DBC without explaining why.
- **No `canFDSignalTimetable`:** This function does not exist. Use `canSignalTimetable` for both CAN and CAN FD signals.
- **BLF LIN requires `ProtocolMode="LIN"`:** Without it, `blfread` returns only CAN data.
- **No signal-level LIN decode:** Only `linMessageTimetable` exists. Access signal values from timetable columns directly.
- **MDF raw CAN detection:** Use channel name prefixes `CAN_DataFrame` / `LIN_Frame` (ASAM standard). Do not use `SourceBusType` metadata -- it is vendor-specific and unreliable.
- **`canMessageImport` default format:** Returns legacy `can.Message` array. Always pass `OutputFormat="timetable"`.
- **Cell extraction:** Multi-channel calls to `blfread`, `mdfRead`, and `canMessageImport` return cell arrays. Extract with `{n}` before processing.
- **Use `canSignalImport` for ASC/TXT signals:** It decodes in one call. Only use `canMessageImport` when raw message timetables are needed.

## File-Specific References

- [ASC import](references/asc-import.md) -- `canSignalImport`/`canMessageImport` with Vector and Kvaser vendors, polymorphic return type handling for multi-channel files
- [BLF import](references/blf-import.md) -- `blfinfo` for file inspection, `blfread` with and without ChannelID, CAN vs LIN protocol selection
- [MDF import](references/mdf-import.md) -- `mdfRead`/`mdfChannelGroupInfo`/`mdfChannelInfo`, detecting raw CAN/LIN groups by channel name, reading specific groups

## Protocol References

- [CAN decode](references/can-decode.md) -- `canMessageTimetable` and `canSignalTimetable` pipelines, DBC and ARXML database usage
- [CAN FD decode](references/canfd-decode.md) -- `canFDMessageTimetable` pipeline, why ARXML does not work for CAN FD
- [LIN decode](references/lin-decode.md) -- `linMessageTimetable` usage, accessing signal values from timetable columns (no signal-level function exists)
- [Database objects](references/database-objects.md) -- `canDatabase` vs `arxmlDatabase` vs `linDatabase`, which decode functions accept which database type

----

Copyright 2026 The MathWorks, Inc.

More from matlab/matlab-agentic-toolkit

SkillDescription
matlab-access-datafeed>
matlab-add-awgnRead BEFORE writing any code that adds Additive White Gaussian Noise (AWGN) to signals and converts between SNR, Eb/No, Es/No, and per-subcarrier SNR for communications simulations, using awgn(), convertSNR(), berawgn(). The default MATLAB patterns for AWGN (e.g., 'measured' option, manual SNR formulas) produce subtly incorrect results. This skill specifies the correct calling conventions, required function usage, and critical anti-patterns that must be avoided.
matlab-analyze-ams-waveformAnalyze AMS waveform data using Mixed-Signal Blockset utilities: phase noise measurement, clock jitter, anti-aliased resampling, timing measurements, lock time, INL/DNL, ADC/DAC calibration, HSpice import. Use when analyzing time-domain voltage from PLL/VCO/clock simulations, measuring phase noise from variable-step solver output, computing jitter, or resampling non-uniform data.
matlab-analyze-dataAnalyze data using MATLAB. Use when the task involves tables, timetables, time-series data, numeric arrays, sensor matrices, or gridded data — including but not limited to exploring, filtering, sorting, cleaning, transforming, aggregating, smoothing, padding, trimming, and answering questions about data. MATLAB provides extensive, easy-to-use built-in functions for these workflows with no additional products required.
matlab-analyze-dependenciesAnalyze the effective toolbox file set to produce a Dependency Manifest — classify all transitive dependencies as included, product, add-on, or external-unresolved, then present resolution options with tradeoffs. Use after matlab-define-toolbox-api when the spec is approved.
matlab-analyze-emS-parameters, insertion loss, fields, currents, mesh control, and solver selection for RF PCB performance validation. TRIGGER: user asks to compute S-parameters, analyze insertion/return loss, extract fields or currents, compare MoM vs FEM, or control mesh for any RF PCB component. Invoke BEFORE writing sparameters() or solver code — API is non-obvious. SKIP: designing or creating components (use the specific matlab-design-pcb-* skill), material/stackup setup only (use matlab-manage-pcb-material), optimization sweeps (use matlab-optimize-pcb-design), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn).
matlab-analyze-installed-antennaAnalyze antennas installed on electrically large conducting platforms using MATLAB Antenna Toolbox. Loads platform geometry from STL/STEP/IGES, installs antenna elements, selects electromagnetic solvers (MoM-PO, FMM, MoM), and computes patterns, impedance, coupling, and efficiency. Use when the user wants to model an antenna on a vehicle, aircraft, ship, satellite, or other large structure.
matlab-analyze-pcb-pdnPDN DC voltage/current analysis, IR drop, design rule checking, and multi-net batch analysis on imported PCB layouts. TRIGGER: user asks about power integrity, PDN analysis, IR drop, voltage distribution, current density, power nets, or design rule checking on a PCB. Invoke BEFORE writing code — the PDN API chain is specialized and non-obvious. SKIP: importing a PCB file (use matlab-read-pcb-layout), EM field/S-parameter extraction (use matlab-analyze-em), material/stackup setup only (use matlab-manage-pcb-material), transmission line design (use matlab-design-pcb-txline).
matlab-analyze-rcsCalculate and visualize monostatic and bistatic radar cross section (RCS) using MATLAB Antenna Toolbox. Computes RCS of platforms, antennas, and arrays with PO, MoM, and FMM solvers, supporting HH/VV/HV/VH polarization, GPU acceleration, and near-field observation. Use when the user wants to compute, plot, or analyze radar cross section.
matlab-analyze-rf-propagationAnalyze RF propagation and plan wireless sites using MATLAB Antenna Toolbox. Creates transmitter/receiver sites, computes signal strength, coverage maps, SINR, line-of-sight, and ray tracing in geographic or indoor environments. Supports multiple propagation models (free-space, close-in, Longley-Rice, ray tracing, rain/gas/fog), custom terrain, building data, and directional antennas. Use when the user wants to compute coverage, signal strength, path loss, SINR, ray tracing, or plan a wireless network.