Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/test-and-measurement/matlab-use-vehicle-network

matlab-use-vehicle-network

Unverified

Use when setting up vehicle network communication in MATLAB using Vehicle Network Toolbox. Covers CAN/CAN FD (fully implemented), with architecture for J1939, XCP, and future protocols. Handles hardware discovery, channel creation, bus configuration, message exchange, signal encoding/decoding, and analysis across all supported vendors. (Vector, Kvaser, PEAK-System, NI, SocketCAN, MathWorks Virtual).

FileKindSize
SKILL.mdskill md13.1 KB
manifest.yamlconfig537 B
references/can/bus-speed-config.mdmarkdown2.2 KB
references/can/channel-creation.mdmarkdown1.5 KB
references/can/database.mdmarkdown3.0 KB
references/can/filters.mdmarkdown2.8 KB
references/can/message-creation.mdmarkdown1.3 KB
references/can/message-extraction.mdmarkdown3.8 KB
references/can/pack-unpack.mdmarkdown2.6 KB
references/can/receive.mdmarkdown1.9 KB
references/can/transmit.mdmarkdown2.3 KB
references/can/troubleshooting/bus-length-guidelines.mdmarkdown3.5 KB
references/can/troubleshooting/diagnostic-workflow.mdmarkdown21.4 KB
references/can/troubleshooting/l1-branches.mdmarkdown11.1 KB
references/can/troubleshooting/l1-domain-knowledge.mdmarkdown6.8 KB
references/can/troubleshooting/l1-failure-scenarios.mdmarkdown3.6 KB
references/can/troubleshooting/l2-analysis-pipeline.mdmarkdown4.5 KB
references/can/troubleshooting/l2-interpretation-tables.mdmarkdown1.8 KB
references/can/troubleshooting/script-interfaces.mdmarkdown2.6 KB
references/shared/channel-lifecycle.mdmarkdown1.1 KB
references/shared/hardware-discovery.mdmarkdown1.1 KB
references/shared/limitations.mdmarkdown1.7 KB
scripts/can/troubleshooting/canBaudRateScanActive.pbinary1.0 KB
scripts/can/troubleshooting/canBaudRateScanPassive.pbinary1.0 KB
scripts/can/troubleshooting/canBurstDetection.pbinary488 B
scripts/can/troubleshooting/canBusLoadCalc.pbinary787 B
scripts/can/troubleshooting/canChannelHealthCheck.pbinary902 B
scripts/can/troubleshooting/canCycleTimeAnalysis.pbinary558 B
scripts/can/troubleshooting/canDiagnosticProbe.pbinary335 B
scripts/can/troubleshooting/canHardwareDiscovery.pbinary290 B
scripts/can/troubleshooting/canLoopbackSelfTest.pbinary628 B
scripts/can/troubleshooting/canSupportSummary.pbinary1.4 KB
scripts/can/troubleshooting/canTrafficOverview.pbinary900 B

references/can/database.md

View on GitHub
# Database

## canDatabase — Load a DBC file

```matlab
db = canDatabase('filename.dbc');
```

- Parses a Vector DBC file and returns a `can.Database` object
- Provides message definitions (ID, name, DLC) and signal definitions (start bit, length, byte order, factor, offset, units)
- `db.Messages` returns a cell array of message name strings
- `db.MessageInfo` returns a struct with per-message details

## Inspecting the Database

```matlab
msgNames = db.Messages;              % cell array of message names
info = db.MessageInfo;               % struct array with message details
```

## attachDatabase — Attach to messages (not channels)

```matlab
attachDatabase(msg, db);
attachDatabase(msg, []);    % detach
```

- `attachDatabase` operates on **message objects**, not channel objects
- After attachment, the message gains a `.Signals` struct for signal-level read/write
- Use on received messages to decode signals from raw bytes
- Pass `[]` to detach (remove signal decode capability)

## canMessage with Database — Auto-Attached on Creation

```matlab
msg = canMessage(db, 'EngineData');
```

- Creates a message with the correct ID and DLC from the database definition
- Database is **automatically attached** — `.Signals` is immediately available
- Signal assignment handles factor/offset/byte-order automatically:

```matlab
msg = canMessage(db, 'EngineData');
msg.Signals.EngineSpeed = 3000;
msg.Signals.EngineTemp = 90;
transmit(ch, msg);
```

## Decoding Received Messages

Received messages are raw (no database attached). Attach after receive:

```matlab
rx = receive(ch, 1);             % returns message object(s)
attachDatabase(rx, db);          % now rx.Signals is available
speed = rx.Signals.EngineSpeed;
temp = rx.Signals.EngineTemp;
```

**With timetable output:** Timetables don't support `attachDatabase`. Extract raw data and decode manually, or receive as objects:

```matlab
rx = receive(ch, 1);            % object output (not timetable)
attachDatabase(rx, db);
disp(rx.Signals.EngineSpeed);
```

## Key Behaviors

- DBC is the only supported database format for CAN (not ARXML — that's for system-level)
- `attachDatabase` is per-message, not per-channel
- Messages created via `canMessage(db, 'Name')` are auto-attached
- Signals with `ValueTable` entries map numeric values to string labels
- Database object is read-only after construction
- Signal assignment respects factor and offset from DBC: physical = raw * factor + offset

## Typical Pattern

```matlab
db = canDatabase('my_vehicle.dbc');
ch1 = canChannel('MathWorks', 'Virtual 1', 1);
ch2 = canChannel('MathWorks', 'Virtual 1', 2);
configBusSpeed(ch1, 500000);
configBusSpeed(ch2, 500000);
start(ch1);
start(ch2);

% Transmit using signal names (auto-attached from db)
msg = canMessage(db, 'EngineData');
msg.Signals.EngineSpeed = 3000;
msg.Signals.EngineTemp = 90;
transmit(ch1, msg);

pause(0.2);

% Receive and decode
rx = receive(ch2, 1);
attachDatabase(rx, db);
disp(rx.Signals.EngineSpeed);
disp(rx.Signals.EngineTemp);

stop(ch1);
stop(ch2);
```

----

Copyright 2026 The MathWorks, Inc.

----
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall