Matlab Create Live Script logo

Matlab Create Live Script

OrganizationPopular
matlab
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+.

Overview

Publishermatlab
Repositorymatlab-agentic-toolkit
Skill namematlab-create-live-script
Stars
1.2K
Forks
138
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by matlab on GitHub. Read the source before you install it.

Installation

Install the Matlab Create Live Script AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/matlab-core/matlab-create-live-script
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit.git /tmp/matlab-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/matlab-agentic-toolkit/skills-catalog/matlab-core/matlab-create-live-script .claude/skills/matlab-create-live-script
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Matlab Create Live Script in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Matlab Create Live Script on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Matlab Create Live Script is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 .mlx file 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:

matlab
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] ## Title on next line
  • No blank lines in the file, except a single blank line directly before %[appendix]
  • No figure command — implicit figure creation only
  • No more than one plot per section (unless using tiled layouts)
  • No close all or clear
  • No mfilename — does not work as intended in live scripts. Hardcode filenames or use pwd.
  • 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 use disp(). 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:

matlab
%[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

SyntaxRenders as
%%Section break
%[text] # TitleH1 heading
%[text] ## SectionH2 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] - itemBullet
%[text] - last \Last bullet
%[text] 1. itemNumbered 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

matlab
%[text:table]
%[text] | Method | Result |
%[text] | --- | --- |
%[text] | Trapezoidal | 1.9998 |
%[text:table]

Example

matlab
%[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

matlab
%[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

matlab
%%
%[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:

matlab
%%
%[text] ## Comparison of Methods
tiledlayout(1,2)
nexttile
plot(method1)
title('Method 1')
nexttile
plot(method2)
title('Method 2')

Workflow

  1. Plan — Title, setup, analysis sections, summary
  2. 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.
  3. Validate (if MATLAB attached) — Run the code through evaluate_matlab_code to confirm it executes cleanly. Note the wall-clock time — Embed Outputs takes about the same.
  4. 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.
  5. 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 .html when 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:

matlab
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 figure commands
  • No close all or clear at 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.


Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Matlab Create Live Script AI 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+.

Why use Matlab Create Live Script on TypingMind?

Because you install it once and use it with any model. Matlab Create Live Script is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Matlab Create Live Script in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/matlab-core/matlab-create-live-script. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Matlab Create Live Script?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Matlab Create Live Script?

As many as you like. As long as a model supports skills, you can use Matlab Create Live Script with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Matlab Create Live Script AI skill free?

It is published on GitHub by matlab. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇