# Matlab Automation

> Use when the task involves MATLAB or Simulink automation in Codex: writing or modifying `.m` files, running MATLAB jobs, executing tests, collecting artifacts, or coordinating MATLAB work through the official MathWorks MCP server.

- Skill: `whisperas/matlab-automation` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add whisperas/matlab-automation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/whisperas/matlab-automation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: WhisperAS (https://skillmd.com/u/whisperas)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/whisperas/matlab-automation

---


# MATLAB Automation Skill

Use this skill for MATLAB-first work in this Codex environment.

Prefer the official MATLAB MCP server for:
- checking installed products
- reviewing MATLAB code
- evaluating short MATLAB snippets
- running `.m` scripts
- running MATLAB test files

Prefer the bundled scripts in this skill for:
- repeatable batch runs
- stable log collection
- artifact directory setup
- fallback execution when the MCP tool is not available in the current thread yet

## Environment expectations

- MATLAB should be installed locally and reachable through `MATLAB_EXE`, `MATLAB_ROOT`, or the system `PATH`.
- The official MathWorks MATLAB MCP server is recommended when available, but these wrappers can still run without it.
- If a local setup uses a no-space alias path for MATLAB, prefer that alias when wiring external tools.

## Workflow

1. Inspect the repository for existing MATLAB entry points before creating new ones.
2. If the task is small and the MCP tools are available, use the MATLAB MCP server first.
3. For longer or repeatable runs, create or update a `.m` entry script and run it via the bundled PowerShell wrapper.
4. Write logs under a project `logs/` directory and results under `artifacts/` when the repo has no stronger convention.
5. Prefer plain `.m` files over `.mlx` for agent-authored automation unless the user explicitly wants a Live Script.
6. For Simulink, prefer script-driven actions such as `open_system`, `set_param`, `sim`, and `save_system`. Do not default to GUI-click automation.

## Recommended repo layout

If the project has no established structure, prefer:

- `matlab/src/`
- `matlab/jobs/`
- `matlab/tests/`
- `matlab/artifacts/`
- `matlab/logs/`
- `matlab/config/`

## MCP-first guidance

When MCP is available in the current session, use it for:

- "What version of MATLAB is installed?"
- "List installed toolboxes."
- "Review this MATLAB file for issues."
- "Run this MATLAB test file."
- "Evaluate this short MATLAB code snippet."

If the current thread does not yet expose the MATLAB MCP server after configuration changes, fall back to the wrapper scripts in `scripts/` and note that a fresh Codex session may be required for MCP tools to appear.

## Script wrappers

Use these bundled scripts when you want deterministic local execution:

- `scripts/run-matlab-batch.ps1`
- `scripts/run-matlab-script.ps1`
- `scripts/init-matlab-job-tree.ps1`

Open `references/local-setup.md` when you need setup guidance for a new machine.
Open `references/project-conventions.md` when you need output and folder conventions.

## Guardrails

- Do not assume a fixed MATLAB install path; honor `MATLAB_EXE`, `MATLAB_ROOT`, or the user's PATH first.
- Do not overwrite user MATLAB code structure without first understanding the existing pattern.
- Do not default to GUI automation for tasks that can be completed by MATLAB or Simulink scripting.
- If a run is long or likely to produce files, state where logs and artifacts will be written before launching it.
- Keep generated MATLAB code ASCII unless the file already uses Unicode intentionally.

