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
.mscripts - 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 systemPATH. - 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
- Inspect the repository for existing MATLAB entry points before creating new ones.
- If the task is small and the MCP tools are available, use the MATLAB MCP server first.
- For longer or repeatable runs, create or update a
.mentry script and run it via the bundled PowerShell wrapper. - Write logs under a project
logs/directory and results underartifacts/when the repo has no stronger convention. - Prefer plain
.mfiles over.mlxfor agent-authored automation unless the user explicitly wants a Live Script. - For Simulink, prefer script-driven actions such as
open_system,set_param,sim, andsave_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.ps1scripts/run-matlab-script.ps1scripts/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.