matlab/matlab-agentic-toolkit/matlab-deploy-embedded-ai
Claude Code and agent skill by matlab/matlab-agentic-toolkit
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or imported models rebuilt as dlnetwork for lean hardware, (2) direct C/C++ code generation from PyTorch and LiteRT models. Both patterns support all targets (Cortex-M/A/R, x86, GPU). Trigger when: user wants to deploy AI to embedded targets; generate C/CUDA from neural networks; compress AI models for MCU; 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, loadLiteRTModel, importNetworkFromPyTorch, importNetworkFromONNX, importNetworkFromTensorFlow, importNetworkFromKeras, dlquantizer, exportNetworkToSimulink, or Embedded Coder with AI models.
Install
npx vskill@latest install matlab/matlab-agentic-toolkit/matlab-deploy-embedded-aiSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as matlab/matlab-agentic-toolkit/matlab-deploy-embedded-ai.
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 the agent can drive a live MATLAB and Simulink session through MCP tools.
When to Use
- Deploying a trained neural network (MATLAB-native or imported) to embedded hardware
- Generating C or CUDA code from a deep learning model for ARM Cortex-M/A/R, x86, or GPU targets
- Deploying imported PyTorch, ONNX, TensorFlow, or LiteRT models to embedded targets (import step handled by
/matlab-import-external-ai-model) - Compressing AI models (quantization, pruning, projection) to fit resource-constrained hardware
- Integrating AI inference into a Simulink system model for closed-loop simulation before code generation
- Using
loadPyTorchExportedProgram,importNetworkFromPyTorch,importNetworkFromONNX,importNetworkFromTensorFlow,dlquantizer,exportNetworkToSimulink, or Embedded Coder with AI models - Choosing between MathWorks-native code generation and direct PyTorch/LiteRT code generation
When NOT to Use
- Training a model purely for research with no deployment target — use Deep Learning Toolbox documentation directly
- Deploying to cloud/server endpoints (no embedded target) — use MATLAB Production Server or MATLAB Compiler SDK
- Working with classical ML models (decision trees, SVMs, ensembles) that aren't neural networks — use Statistics and Machine Learning Toolbox codegen workflows directly. Note:
fitcnet/fitrnetneural network models ARE covered by this skill - Generating code for non-AI Simulink models — use standard Embedded Coder workflows
- Converting between model formats without an embedded deployment goal (e.g., ONNX to MATLAB for desktop inference only)
Workflow Pattern Selection
This skill uses two deployment patterns:
- Pattern 1 — MATLAB Network Codegen: Import or build a
dlnetwork, optionally
compress it, then generate C/C++ via MATLAB Coder or export to Simulink. See `references/pattern1/workflow.md`.
- Pattern 2 — PyTorch/LiteRT Direct Codegen: Load a PyTorch (.pt2) or LiteRT
(.tflite) model directly and generate C/C++ without converting to a dlnetwork. See `references/pattern2/workflow.md`.
Decision Tree
Primary discriminator for external models: deployment capabilities + hardware class.
Pattern Summary
| Pattern | When to Use | Primary Toolchain | |
|---|---|---|---|
| 1 — MATLAB Network Codegen | Model trained in MATLAB, OR external model needing compression/quantization/Simulink export/weight inspection, OR Cortex-M targets | MATLAB Coder™ / Embedded Coder™ | |
| 2 — PyTorch/LiteRT Direct Codegen | External PyTorch (.pt2) or LiteRT (.tflite) model on x86/GPU/Cortex-A targets; shorter path to C code without compression | MATLAB Coder™ + PyTorch & LiteRT SPKG |
Pattern 2's generated C is portable to any target, but Cortex-M deployments typically require Pattern 1 capabilities (compression, Simulink verification).
Import step (Pattern 1): For PyTorch/ONNX/Keras/TensorFlow model import, use /matlab-import-external-ai-model. This skill takes over after import for the compression, Simulink integration, and code generation phases.
Pattern 1 vs Pattern 2 Capability Comparison
| Capability | Pattern 1 (dlnetwork) | Pattern 2 (PyTorch/LiteRT direct) | |
|---|---|---|---|
| C code generation | Yes | Yes | |
| Target: Cortex-M, Cortex-A/R, x86, GPU | 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) | |
| Combined compression | Yes | No | |
| Speed to first C code | Slower | Faster |
Rule of thumb: Choose Pattern 1 when you need to compress, quantize, inspect weights, or use exportNetworkToSimulink — or when the model is already a dlnetwork, or when targeting Cortex-M. Choose Pattern 2 when the model is already in PyTorch (.pt2) or LiteRT (.tflite) format and you want the shorter path to C code without compression.
Stats/ML models (fitrnet/fitcnet): These follow Pattern 1 but have their own Simulink integration path. Use the RegressionNeuralNetwork Predict block (for fitrnet) or ClassificationNeuralNetwork Predict block (for fitcnet) from the Statistics and Machine Learning Toolbox library — do NOT use exportNetworkToSimulink (which is for dlnetwork only). Configure simulation programmatically with Simulink.SimulationInput.
Common Start: Prerequisites
Regardless of pattern, always begin with these two prerequisite steps before entering the pattern-specific phases (which start at Phase 1):
- Environment Discovery (silent): Load `references/shared/environment-setup.md`
- Project Discovery (interactive): Load `references/shared/project-discovery.md`
Project Discovery determines the workflow pattern via the decision tree above.
Do Not Use (Legacy Functions)
| Legacy | Modern Replacement | |
|---|---|---|
trainNetwork / train (for DL) | trainnet | |
DAGNetwork / SeriesNetwork / network | dlnetwork | |
taylorPrunableNetwork / updateScore / updatePrunables | compressNetworkUsingTaylorPruning (when trainable with trainnet); use taylorPrunableNetwork for custom training loops | |
csvread / xlsread | readmatrix / readtable | |
datenum | datetime |
For legacy import functions (importONNXNetwork, importKerasNetwork, etc.), see /matlab-import-external-ai-model which handles all model import workflows.
Global Rules
Advisory vs Execution Mode
Distinguish between two modes based on the user's intent:
- Advisory ("How should I approach this?", "What workflow?", "Which pattern?"): Answer
the routing question directly — state the recommended Pattern, explain why, and outline the high-level steps. Do NOT enter Environment Discovery or start asking prerequisite questions. After giving the recommendation, ask if the user wants to begin execution.
- Execution ("Deploy my model", "Walk me through", "Write the script"): Enter the full
prerequisite flow (Environment Discovery → Project Discovery → step-by-step phases).
ALWAYS
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills-catalog/ai-and-statistics/matlab-deploy-embedded-ai/SKILL.md
Popularity
- Repository stars
- 909
- Repository forks
- 112
- 7-day trend score
- 34
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/matlab/matlab-agentic-toolkit/matlab-deploy-embedded-ai)