matlab/matlab-agentic-toolkit / skills-catalog/test-and-measurement/matlab-use-vehicle-network
matlab-use-vehicle-network
UnverifiedUse 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).
references/can/message-creation.md
View on GitHub# Message Creation
## canMessage — CAN Classic or CAN FD
```matlab
% CAN Classic (DLC 0–8)
msg = canMessage(id, isExtended, dlc);
% CAN FD via ProtocolMode
msg = canMessage(id, isExtended, dlc, ProtocolMode="CAN FD");
% From database definition
msg = canMessage(candb, "MessageName");
```
- `id`: numeric CAN identifier
- `isExtended`: `false` = 11-bit ID (0x000–0x7FF), `true` = 29-bit ID (0x00000000–0x1FFFFFFF)
- `dlc`: data length in bytes
- Database messages inherit `ProtocolMode` from the DB — cannot override
## canFDMessage — CAN FD Only
```matlab
msg = canFDMessage(id, isExtended, dlc);
msg = canFDMessage(candb, "MessageName");
```
Equivalent to `canMessage(..., ProtocolMode="CAN FD")`.
## Setting Data
```matlab
msg.Data = uint8([0xDE 0xAD 0xBE 0xEF 0x01 0x02 0x03 0x04]);
```
- Data must be `uint8` array matching the specified DLC
## Valid DLC Sizes
| Protocol | Valid DLC values |
|----------|-----------------|
| CAN Classic | 0, 1, 2, 3, 4, 5, 6, 7, 8 |
| CAN FD | 0, 8, 12, 16, 20, 24, 32, 48, 64 |
## Common Mistake
Using `canMessage(id, ext, 64)` without `ProtocolMode="CAN FD"` gives:
```
Error: Expected DATALENGTH to be an array with all of the values <= 8.
```
Fix: use `canFDMessage` or add `ProtocolMode="CAN FD"`.
----
Copyright 2026 The MathWorks, Inc.
----
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |