/embedded-ai-deployment
Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or 3P-imported models rebuilt as dlnetwork for lean hardware (Cortex-M, DSP), (2) direct C/C++ code generation from PyTorch and
$ npx -y skills add matlab/skills --skill embedded-ai-deployment --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/embedded-ai-deployment
Context preview
The summary Claude sees to decide when to auto-load this skill.
Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or 3P-imported models rebuilt as dlnetwork for lean hardware (Cortex-M, DSP), (2) direct C/C++ code generation from PyTorch and
SKILL.md
embedded-ai-deployment.SKILL.mdname: embedded-ai-deployment
description: >
Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink,
Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or 3P-imported
models rebuilt as dlnetwork for lean hardware (Cortex-M, DSP), (2) direct C/C++
code generation from PyTorch and LiteRT models for high-performance hardware
(Cortex-A, x86, GPU).
Trigger when: user wants to deploy AI to embedded targets; generate C/CUDA from
neural networks; compress AI models for MCU/DSP; integrate AI in Simulink for
system-level simulation; import PyTorch/ONNX/TensorFlow models for embedded
deployment; optimize AI for resource-constrained hardware; or use
loadPyTorchExportedProgram, importNetworkFromPyTorch, dlquantizer,
exportNetworkToSimulink, or Embedded Coder with AI models.
license: MathWorks BSD-3-Clause (see LICENSE)
metadata:
author: MathWorks
version: "1.0"
Embedded AI for Engineered Systems
Deploy AI models to embedded hardware using MATLAB® and Simulink®. This skill is written specifically for **MATLAB R2026a** and uses APIs, functions, and workflows introduced in that release. It covers the complete lifecycle: model creation or import, verification, compression, system-level simulation, and code generation for resource-constrained targets.
Requires MATLAB R2026a or newer. Core toolboxes: Deep Learning Toolbox, Statistics and Machine Learning Toolbox, MATLAB Coder, Embedded Coder, Simulink, and Fixed-Point Designer. Workflow-specific support packages are checked during Environment Discovery. The MATLAB and Simulink Agentic Toolkits must be available so Codex can drive a live MATLAB and Simulink session through MCP tools.
Workflow Pattern Selection
Determine the correct workflow pattern based on model origin and deployment target.
Decision Tree
Primary discriminator for 3P models: **model size + hardware class**.
Q1: What is the deployment target?
|
+-- Cortex-M (M33, M4, M7) ---------------------> Q2
+-- Cortex-A/R processor or DSP (C2000, etc.) ----> Q2
+-- x86 processor or GPU (Jetson, CUDA) ----------> Q2
|
Q2: Where does the AI model come from?
|
+-- Train from scratch in MATLAB ------------> Pattern 1 (references/pattern1/workflow.md)
+-- Pre-trained 3P model --------------------> Q3
|
Q3: Route by hardware class + model size
|
+-- Cortex-M: always Pattern 1 import
| (MathWorks compression, tight sim-codegen agreement)
|
+-- x86 / GPU: Pattern 2 if PyTorch or LiteRT
| Pattern 1 import if ONNX/TF (convert to Py/LiteRT recommended)
|
+-- Cortex-A/R or DSP:
+-- Small model (< 500 KB) ---------> Pattern 1 with import path
+-- Large model (> 1 MB):
+-- PyTorch / LiteRT -----------> Pattern 2
+-- ONNX / TensorFlow ----------> Pattern 1 import *\* Convert to PyTorch® (.pt2) or LiteRT (.tflite) to use Pattern 2 instead.
Pattern Summary
| Pattern | Model Origin | Target Hardware | Primary Toolchain | |---------|-------------|-----------------|-------------------| | **1** | MATLAB-native or 3P imported as dlnetwork | ARM® Cortex®-M (M33, M4, M7), Cortex-A/R, DSP | Embedded Coder™ | | **2** | PyTorch (.pt2) or LiteRT (.tflite) direct code generation | Cortex-A/R, DSP, x86, GPU | MATLAB Coder™ + PyTorch & LiteRT SPKG |
Pattern 1 vs Pattern 2 Capability Comparison
| Capability | Pattern 1 (dlnetwork) | Pattern 2 (PyTorch/LiteRT direct) | |-----------|----------------------|----------------------| | C code generation | Yes | Yes | | Weight inspection / modification | **Yes** | No | | dlquantizer (INT8) | **Yes** | No | | Projection (compressNetworkUsingProjection) | **Yes** | No | | Pruning | **Yes** | No | | Simulink integration | **Yes** (exportNetworkToSimulink) | **Yes** (PyTorch SPKG Simulink blocks) | | Fixed-point codegen | **Yes** | No | | Combined compression (77%+ flash savings) | **Yes** | No | | Speed to first C code | Slower | **Faster** | | Requires native rebuild for 3P models | Yes | No |
**Rule of thumb:** Choose Pattern 1 for small models (< 500 KB) on lean hardware (Cortex-M, DSP) where you need MathWorks compression and tight simulation-codegen agreement. Choose Pattern 2 for larger models (> 1 MB) on high-performance hardware (x86, GPU, Cortex-A) where simulation speed is a priority and compression is done externally in Python. For Cortex-A/R and DSP targets, model size is the primary discriminator. Pattern 2 supports PyTorch (.pt2) and LiteRT (.tflite) formats. Both patterns support Simulink integration.
Common Start: Prerequisites
Regardless of pattern, **always** begin with these two prerequisite steps before entering the pattern-specific phases (which start at Phase 1):
1. **Environment Discovery** (silent): Load [`references/shared/environment-setup.md`](references/shared/environment-setup.md) 2. **Project Discovery** (interactive): Load [`references/shared/project-discovery.md`](references/shared/project-discovery.md)
Project Discovery determines the workflow pattern via the decision tree above.
Banned Legacy Functions
| Legacy (BANNED) | Modern Replacement | |-----------------|-------------------| | `trainNetwork` / `trainnetwork` / `train` (for DL) | `trainnet` | | `DAGNetwork` / `SeriesNetwork` / `network` | `dlnetwork` | | `importONNXNetwork` / `importONNXLayers` | `importNetworkFromONNX` | | `importTensorFlowNetwork` / `importKerasNetwork` | `importNetworkFromTensorFlow` | | `importTensorFlowLayers` / `importKerasLayers` | `importNetworkFromTensorFlow` | | `taylorPrunableNetwork` / `updateScore` / `updatePrunables` | `compressNetworkUsingTaylorPruning` | | `csvread` / `xlsread` | `readmatrix` / `readtable` | | `datenum` | `datetime` |
Global Rules
ALWAYS
Read more
name: embedded-ai-deployment description: > Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or 3P-imported models rebuilt as dlnetwork for lean hardware (Cortex-M, DSP), (2) direct C/C++ code generation from PyTorch and LiteRT models for high-performance hardware (Cortex-A, x86, GPU). Trigger when: user wants to deploy AI to embedded targets; generate C/CUDA from neural networks; compress AI models for MCU/DSP; integrate AI in Simulink for system-level simulation; import PyTorch/ONNX/TensorFlow models for embedded deployment; optimize AI for resource-constrained hardware; or use loadPyTorchExportedProgram, importNetworkFromPyTorch, dlquantizer, exportNetworkToSimulink, or Embedded Coder with AI models. license: MathWorks BSD-3-Clause (see LICENSE) metadata: author: MathWorks version: "1.0"
Embedded AI for Engineered Systems
Deploy AI models to embedded hardware using MATLAB® and Simulink®. This skill is written specifically for **MATLAB R2026a** and uses APIs, functions, and workflows introduced in that release. It covers the complete lifecycle: model creation or import, verification, compression, system-level simulation, and code generation for resource-constrained targets.
Requires MATLAB R2026a or newer. Core toolboxes: Deep Learning Toolbox, Statistics and Machine Learning Toolbox, MATLAB Coder, Embedded Coder, Simulink, and Fixed-Point Designer. Workflow-specific support packages are checked during Environment Discovery. The MATLAB and Simulink Agentic Toolkits must be available so Codex can drive a live MATLAB and Simulink session through MCP tools.
Workflow Pattern Selection
Determine the correct workflow pattern based on model origin and deployment target.
Decision Tree
Primary discriminator for 3P models: **model size + hardware class**.
Q1: What is the deployment target?
|
+-- Cortex-M (M33, M4, M7) ---------------------> Q2
+-- Cortex-A/R processor or DSP (C2000, etc.) ----> Q2
+-- x86 processor or GPU (Jetson, CUDA) ----------> Q2
|
Q2: Where does the AI model come from?
|
+-- Train from scratch in MATLAB ------------> Pattern 1 (references/pattern1/workflow.md)
+-- Pre-trained 3P model --------------------> Q3
|
Q3: Route by hardware class + model size
|
+-- Cortex-M: always Pattern 1 import
| (MathWorks compression, tight sim-codegen agreement)
|
+-- x86 / GPU: Pattern 2 if PyTorch or LiteRT
| Pattern 1 import if ONNX/TF (convert to Py/LiteRT recommended)
|
+-- Cortex-A/R or DSP:
+-- Small model (< 500 KB) ---------> Pattern 1 with import path
+-- Large model (> 1 MB):
+-- PyTorch / LiteRT -----------> Pattern 2
+-- ONNX / TensorFlow ----------> Pattern 1 import *\* Convert to PyTorch® (.pt2) or LiteRT (.tflite) to use Pattern 2 instead.
Pattern Summary
| Pattern | Model Origin | Target Hardware | Primary Toolchain | |---------|-------------|-----------------|-------------------| | **1** | MATLAB-native or 3P imported as dlnetwork | ARM® Cortex®-M (M33, M4, M7), Cortex-A/R, DSP | Embedded Coder™ | | **2** | PyTorch (.pt2) or LiteRT (.tflite) direct code generation | Cortex-A/R, DSP, x86, GPU | MATLAB Coder™ + PyTorch & LiteRT SPKG |
Pattern 1 vs Pattern 2 Capability Comparison
| Capability | Pattern 1 (dlnetwork) | Pattern 2 (PyTorch/LiteRT direct) | |-----------|----------------------|----------------------| | C code generation | Yes | Yes | | Weight inspection / modification | **Yes** | No | | dlquantizer (INT8) | **Yes** | No | | Projection (compressNetworkUsingProjection) | **Yes** | No | | Pruning | **Yes** | No | | Simulink integration | **Yes** (exportNetworkToSimulink) | **Yes** (PyTorch SPKG Simulink blocks) | | Fixed-point codegen | **Yes** | No | | Combined compression (77%+ flash savings) | **Yes** | No | | Speed to first C code | Slower | **Faster** | | Requires native rebuild for 3P models | Yes | No |
**Rule of thumb:** Choose Pattern 1 for small models (< 500 KB) on lean hardware (Cortex-M, DSP) where you need MathWorks compression and tight simulation-codegen agreement. Choose Pattern 2 for larger models (> 1 MB) on high-performance hardware (x86, GPU, Cortex-A) where simulation speed is a priority and compression is done externally in Python. For Cortex-A/R and DSP targets, model size is the primary discriminator. Pattern 2 supports PyTorch (.pt2) and LiteRT (.tflite) formats. Both patterns support Simulink integration.
Common Start: Prerequisites
Regardless of pattern, **always** begin with these two prerequisite steps before entering the pattern-specific phases (which start at Phase 1):
1. **Environment Discovery** (silent): Load [`references/shared/environment-setup.md`](references/shared/environment-setup.md) 2. **Project Discovery** (interactive): Load [`references/shared/project-discovery.md`](references/shared/project-discovery.md)
Project Discovery determines the workflow pattern via the decision tree above.
Banned Legacy Functions
| Legacy (BANNED) | Modern Replacement | |-----------------|-------------------| | `trainNetwork` / `trainnetwork` / `train` (for DL) | `trainnet` | | `DAGNetwork` / `SeriesNetwork` / `network` | `dlnetwork` | | `importONNXNetwork` / `importONNXLayers` | `importNetworkFromONNX` | | `importTensorFlowNetwork` / `importKerasNetwork` | `importNetworkFromTensorFlow` | | `importTensorFlowLayers` / `importKerasLayers` | `importNetworkFromTensorFlow` | | `taylorPrunableNetwork` / `updateScore` / `updatePrunables` | `compressNetworkUsingTaylorPruning` | | `csvread` / `xlsread` | `readmatrix` / `readtable` | | `datenum` | `datetime` |
Global Rules
ALWAYS
A sandbox for prototyping and demonstrating Agent Skills for MATLAB and Simulink work. Skills here are experimental. They may be incomplete, change without notice, or migrate to an official toolkit over time.
Repo: matlab/skills
Other skills on agent-skills-playground.
- /agent-skill-author
Use this skill when the user wants to author, design, scope, or refine an Agent Skill (a SKILL.md file). Trigger phrases include "build a new skill", "design an agent skill", "scope a SKILL.md", "how should I structure this skill", "write a skill for X", "my skill isn't working
Open skill - /matlab-project
Use this skill for any work involving a MATLAB Project (.prj file) — creating a new project, tracking files, managing the project path, configuring Simulink cache and code-generation folders, running project health checks, or writing build scripts that keep the project in sync
Open skill - /mbse-architecture
Use this skill for the architecture phases of an MBSE workflow in MATLAB, when writing idempotent buildXxx.m scripts that produce a three-layer RFLPV architecture (Functional, Logical, Physical) with interface dictionaries, stereotype profiles, allocation sets, and requirements
Open skill - /mbse-workflow
Use this skill for guided MBSE work in MATLAB — starting a new project, resuming work mid-workflow on an existing project, or answering orientation questions about how the MBSE skills fit together. Trigger when the user says they want to create, start, or set up a new MBSE
Open skill - /simulink-requirements
Use this skill for all requirements-related work in a MATLAB MBSE project using the Requirements Toolbox (slreq). Covers creating and populating requirement sets, derivation links, test case requirements, verification coverage, reading and tracing links across requirement sets
Open skill - /system-composer
Use this skill when authoring reusable, idempotent MATLAB scripts that build System Composer architecture models via the architecture-modeling API — `systemcomposer.createModel`, `addComponent`, `addPort`, `setInterface`, `connect(srcPort, dstPort)`, interface dictionaries
Open skill

