
matlab-create-live-script
Create, edit, and run plain-text MATLAB live scripts (.m files) with rich text formatting, LaTeX equations, section breaks, and inline figures. Use when generating tutorials, analysis notebooks, reports, documentation, or educational content, when modifying existing live scripts, or when converting existing binary .mlx files to .m for version control. Requires R2025a+.
- Installs
- 122
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-create-live-script- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads matlab-create-live-script automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Live Scripts
Plain-text .m files that render as rich documents in the MATLAB Live Editor. Version-control friendly — never use binary .mlx.
When to Use
- Tutorials, reports, analysis notebooks, or documentation
- Interactive exploration with inline figures and equations
- Version-controlled content (plain-text
.m, not binary.mlx) - Converting an existing binary
.mlxfile to plain-text.m
When NOT to Use
- Regular scripts without rich formatting
- Function files
- MATLAB older than R2025a
Converting from .mlx
To convert a binary .mlx file to a plain-text .m live script, run the following at the MATLAB Command Window. The recipe is not part of the resulting .m file:
editor = matlab.desktop.editor.openDocument(mlxPath, Visible=0);
editor.saveAs(newMPath); % use .m extension
editor.closeNoPrompt;
Rules
- Text lines use
%[text]— NOT bare% - One paragraph = one
%[text]line — do not hard-wrap; let the Live Editor handle line width - No empty
%[text]lines — they render as unwanted blank space - Section headers:
%%on its own line, then%[text] ## Titleon next line - No blank lines in the file, except a single blank line directly before
%[appendix] - No
figurecommand — implicit figure creation only - No more than one plot per section (unless using tiled layouts)
- No
close allorclear - No
mfilename— does not work as intended in live scripts. Hardcode filenames or usepwd. - Escape these characters when used as literal text (not as markdown syntax):
*,_,[,],`,\. Also escape.after a digit and#at line start. - Equations use single-
$inline form only:$ a = \\pi r^2 $(no$$ ... $$). For a centered/display equation, wrap the line:%[text]{"align":"center"} $ X(k) = \\sum\_{n=0}^{N-1} x(n) e^{-j2\\pi kn/N} $ - Inside an equation, LaTeX commands take double backslashes (
\\sin,\\frac,\\pi) and markdown characters take single (\_,\*). Use a tool that takes literal text (Edit, Write, fwrite) — don't use Bash heredocs; they collapse\\to\even when quoted, which corrupts LaTeX equations. - Last list item (bulleted or numbered) ends with
\ - Every file ends with the required appendix
- Avoid
fprintf— drop the semicolon or usedisp(). Output appears inline below the code that produced it, not in the Command Window. - Outputs should serve the reader's understanding, not verify execution
Required Appendix
Every live script must end with:
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
% data: {"layout":"inline"}
%---
Reading live scripts (Token Optimization)
When reading a live script file, ignore everything below the %[appendix] marker. The appendix contains embedded images and metadata that consume tokens without adding useful information. All code and text content appears before it.
Format Reference
| Syntax | Renders as |
|---|---|
%% | Section break |
%[text] # Title | H1 heading |
%[text] ## Section | H2 heading |
%[text] **bold** | Bold |
%[text] *italic* | Italic |
%[text] `code` | Monospace |
%[text] <u>text</u> | Underlined text |
%[text] $ a = \\pi r^2 $ | Inline equation |
%[text]{"align":"center"} $ ... $ | Centered/display equation |
%[text] - item | Bullet |
%[text] - last \ | Last bullet |
%[text] 1. item | Numbered list |
%[text] 2. last \ | Last numbered item |
%[text] [text](url) | External hyperlink |
%[text] [text](internal:id) | Internal link to an anchor |
%[text] %[text:anchor:id] ... | Anchor (link target) |
%[text:tableOfContents]{"heading":"..."} | Table of Contents |
IDs (anchors, and any other id-bearing element): letters, digits, and underscores only. No hyphens — my-section won't bind; use my_section. For anchors, place the marker immediately after %[text] at the start of the line.
Tables
%[text:table]
%[text] | Method | Result |
%[text] | --- | --- |
%[text] | Trapezoidal | 1.9998 |
%[text:table]
Example
%[text] # Sinusoidal Signals
%[text] Examples of sinusoidal signals in MATLAB.
%[text:tableOfContents]{"heading":"Contents"}
%[text] - sine waves
%[text] - cosine waves \
x = linspace(0,8*pi);
%%
%[text] ## Sine Wave
plot(x,sin(x))
title('Sine Wave')
xlabel('x (radians)')
ylabel('sin(x)')
grid on
%%
%[text] ## Cosine Wave
plot(x,cos(x))
title('Cosine Wave')
xlabel('x (radians)')
ylabel('cos(x)')
grid on
%%
%[text] ## Summary
%[text] The sine and cosine functions are $ \\pi/2 $ radians out of phase.
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
% data: {"layout":"inline"}
%---
Common Patterns
Mathematical Explanations with Equations
%[text] ## Theory
%[text] The discrete Fourier transform is defined as:
%[text]{"align":"center"} $ X(k) = \\sum\_{n=0}^{N-1} x(n) e^{-j2\\pi kn/N} $
%[text] where $ x(n) $ are the time-domain samples and $ k $ indexes the frequency bins.
Code with Inline Comments
%%
%[text] ## Data Processing
%[text] Load and filter the data, then visualize the results.
data = load('measurements.mat');
filtered = lowpass(data, 0.5); % Apply lowpass filter
plot(filtered)
title('Filtered Data')
Tiled Layouts for Comparison
Use only when side-by-side comparison is important to the illustration:
%%
%[text] ## Comparison of Methods
tiledlayout(1,2)
nexttile
plot(method1)
title('Method 1')
nexttile
plot(method2)
title('Method 2')
Workflow
- Plan — Title, setup, analysis sections, summary
- Write —
%[text]for text,%%for sections, appendix at end. Use a tool that takes literal text (Edit, Write, fwrite). Don't use Bash heredocs (cat > file <<EOF); they collapse\\to\even when quoted, which corrupts LaTeX equations. - Validate (if MATLAB attached) — Run the code through
evaluate_matlab_codeto confirm it executes cleanly. Note the wall-clock time — Embed Outputs takes about the same. - Embed Outputs (optional, if MATLAB attached) — Run
executeLiveScript("<absolute-path>.m")to save each section's outputs (plots, displayed values) inline next to the code that produced them. - Verify Rendering (optional, if MATLAB attached) — Run
export("<absolute-path>.m", "<absolute-path>.html")to produce an HTML approximation of the rendered document. Read it back to confirm equations are typeset, figures appear inline,%[text]directives don't leak as literal text, etc. Delete the.htmlwhen done — it's a verification artifact, not a deliverable.
The Write step is the load-bearing one — Write alone produces a valid live script the user can open and run. Validate, Embed Outputs, and Verify Rendering are progressive enhancements that require an attached MATLAB session. Without one, stop after Write. After Embed Outputs, the file is rewritten to disk by MATLAB — re-read before any further edits.
executeLiveScript
Bundled in the scripts/ folder of this skill. Add to path before first use:
addpath(fullfile(skillRoot, "scripts")); % skillRoot = directory containing this SKILL.md
Calling executeLiveScript(filePath) returns nothing on success. Runtime errors inside the script do not raise exceptions — the script writes them into the appendix as "dataType":"error" blocks; grep the saved .m to find them.
Run Validate before Embed Outputs. If a cell errors during Embed Outputs, that cell becomes an error block and outputs in cells after it are stripped from the file. Run through evaluate_matlab_code first.
If Embed Outputs errors with "Nested Live Editor execution" or hangs past the Validate time: retry once with the MATLAB desktop visible. If that also fails, the on-disk file from Write is still valid — skip Embed Outputs and let the user run the script themselves.
Checklist
Before finishing a live script, verify:
- File has .m extension
- Sections use
%%alone on its own line, followed by%[text] ## - No blank lines or empty
%[text]lines (except one blank line directly before%[appendix]) - Each paragraph is a single
%[text]line (no hard-wrapping) - One plot per section (unless tiled layout)
- Bulleted and numbered lists end with backslash on last item
- LaTeX command backslashes are doubled in the saved file:
\\sin,\\frac,\\pi - No
figurecommands - No
close allorclearat start - No
mfilename - Appendix is present and correctly formatted
- Outputs serve the reader, not the developer
Not Yet Supported
Minor features planned for a future revision:
- Interactive controls (sliders, dropdowns, numeric inputs)
- Hide Code View (output view that hides the source code)
Copyright 2026 The MathWorks, Inc.
FAQ
What does the matlab-create-live-script skill do?
Create, edit, and run plain-text MATLAB live scripts (.m files) with rich text formatting, LaTeX equations, section breaks, and inline figures. Use when generating tutorials, analysis notebooks, reports, documentation, or educational content, when modifying existing live scripts, or when converting existing binary .mlx files to .m for version control. Requires R2025a+.
How do I install matlab-create-live-script?
Run npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-create-live-script in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/matlab-create-live-script/ (personal) or .claude/skills/matlab-create-live-script/ (project).
Which AI agents can use matlab-create-live-script?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is matlab-create-live-script safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains matlab-create-live-script?
It is published by matlab in matlab/matlab-agentic-toolkit. It has 122 recorded installs.
More from matlab/matlab-agentic-toolkit
matlab-review-code
matlab/matlab-agentic-toolkit
Review MATLAB code for quality, performance, maintainability, and adherence to MathWorks coding standards. Uses checkmatlabcode and matlabcodingguidelines. Use when reviewing code, checking style, finding code smells, assessing quality, or preparing code for handoff or publication.
matlab-analyze-data
matlab/matlab-agentic-toolkit
Analyze data using MATLAB. Use when the task involves tables, timetables, time-series data, numeric arrays, sensor matrices, or gridded data — including but not limited to exploring, row filtering, sorting, cleaning, transforming, aggregating, smoothing, padding, trimming, and answering questions about data. MATLAB provides extensive, easy-to-use built-in functions for these workflows with no additional products required.
matlab-design-digital-filter
matlab/matlab-agentic-toolkit
Design and validate digital filters in MATLAB. Use when cleaning up noisy signals, removing interference, filtering signals, designing FIR/IIR filters (lowpass/highpass/bandpass/bandstop/notch), or comparing filters in Filter Analyzer.
matlab-modernize-code
matlab/matlab-agentic-toolkit
Modernize removed or discouraged MATLAB functions and patterns. Use when the checkmatlabcode MCP tool reports that a function "is not recommended", "will be removed in a future release", or "has been removed" — at any severity (info, warning, or error) — when migrating legacy code, or when replacing removed or discouraged APIs with current equivalents. Also applies to discouraged patterns Code Analyzer does not flag (containers.Map, bsxfun, str2num, eval, clear all) and to removed or discouraged functions such as trainNetwork, csvread, xlsread, datenum, guide, svmtrain, ltln2val, webmap.
matlab-agentic-toolkit-setup
matlab/matlab-agentic-toolkit
Install and configure the MATLAB Agentic Toolkit — detect MATLAB, install the MCP server, register with your AI coding agent, and verify the environment. Supports Claude Code, Codex, GitHub Copilot, Amp, and Gemini CLI.
matlab-build-app
matlab/matlab-agentic-toolkit
Build MATLAB apps from requirements to working code. Asks discovery questions (or skips them when the path is known), recommends UIFigure or UIHTML architecture, identifies layout archetype (Dashboard, Explorer, Tabbed, Wizard, Canvas), produces an implementation plan, and executes the build. For UIFigure apps, optionally serializes as App Designer (.mlapp or plain-text .m + .xml). Use when a user wants to build a MATLAB app, create a GUI, make an interactive tool, build a uifigure app, build a uihtml app, build an App Designer app, build a .mlapp app, build a plain-text App Designer app, or asks which approach to use. Also use when user describes spatial layout needs: dashboard, control panel, sidebar, tabs, wizard, stepper, canvas, workspace.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available