Exports MATLAB code from a conversation into a clean, runnable .m script with section headers and deduplication.
Ships in rf-and-mixed-signal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Extracts all MATLAB code executed during the current conversation, assembles it into a well-documented, runnable .m script, and saves it to the working directory.
| Step | Action |
|---|---|
| 1. Scan | Walk assistant messages chronologically; extract each executed MATLAB code block |
| 2. Deduplicate | Keep only the final successful version of repeated blocks |
| 3. Order | Arrange into logical workflow order (setup, model, config, analysis, visualization) |
| 4. Format | Add %% section headers, consolidate parameters at top |
| 5. Save | Write to Results/<descriptive_name>.m under the working directory |
addpath calls needed for utility functions used during the sessionsbm wrappersfprintf statements used to relay info back (keep user-facing ones)'Visible','off' on figures -- the exported script is for interactive useWhen the same block was run multiple times (e.g., to fix an error), keep only the final successful version. Do not include intermediate failed attempts or parameter corrections -- use the values that worked.
Walk through all assistant messages chronologically. For each MATLAB code block that was executed (via MCP, -batch, or similar), extract the MATLAB portion and note:
Arrange extracted code into a natural workflow order, which may differ from execution order:
%% <Title> -- <One-line summary>
% <Multi-line description of what this script does.>
% <Key context: what design, what board, what analysis, etc.>
%
% Required toolboxes: <list only what was actually used>
%% Step 1: <Description>
% <Why this step matters>
<code>
%% Step 2: <Description>
<code>
%% section breaks for each logical step (creates foldable sections in MATLAB Editor)title() / xlabel() TeX strings: \_ not _Derive from the session's primary task. Use lowercase with underscores:
openrex_core_rail_dc_analysis.mhairpin_filter_design_2p4ghz.mvia_crosstalk_sweep.mSave to Results/ under the working directory. Create the folder if it doesn't exist.
Tell the user:
freq, substrate, dimensions) into the setup section so the user can modify them without hunting through the script.if ~exist('BATCH_MODE', 'var') guards. But default to showing figures for interactive use.fullfile() for cross-platform paths. Never hard-code absolute paths.matlab -batch, add at the top:
%% Configuration
BATCH_MODE = exist('BATCH_MODE', 'var') || ~usejava('desktop');
if ~BATCH_MODE, close all; clc; end
Results/ subfolder:
resultsDir = fullfile(pwd, 'Results');
if ~exist(resultsDir, 'dir'), mkdir(resultsDir); end
Do not include shell commands. Only MATLAB code belongs in the exported script. PowerShell, Bash, and sbm wrapper invocations must be stripped. If a shell step is essential (e.g., downloading a file), replace it with a comment noting the prerequisite.
Do not keep failed iterations. When a code block was re-run after fixing an error, only the final successful version should appear. Including intermediate failures makes the script unrunnable.
Do not scatter parameters. Hard-coded values buried inside analysis or plotting sections are difficult to find and modify. Always hoist user-configurable parameters (freq, substrate, dimensions, file paths) into the setup section at the top.
Do not hard-code absolute paths. Paths like C:\Users\viyer\... break on other machines. Use fullfile() and relative paths, or place path variables in the setup section.
Do not leave 'Visible','off' on figures. Agent sessions suppress figure windows for non-interactive execution, but exported scripts are meant for interactive use. Remove 'Visible','off' arguments from figure() calls.
Escape underscores in TeX strings. MATLAB interprets _ as a subscript in title(), xlabel(), ylabel(), and legend() calls by default. Use \_ or set 'Interpreter','none'.
Copyright 2026 The MathWorks, Inc.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/rf-and-mixed-signal:matlab-export-session-scriptfrom rf-and-mixed-signal
npx claudepluginhub matlab/matlab-agentic-toolkit --plugin rf-and-mixed-signal21 skills in this plugin
/matlab-analyze-ams-waveformAnalyze AMS waveform data using Mixed-Signal Blockset utilities: phase noise measurement, clock jitter, anti-aliased resampling, timing measurements, lock time, INL/DNL, ADC/DAC calibration, HSpice import. Use when analyzing time-domain voltage from PLL/VCO/clock simulations, measuring phase noise from variable-step solver output, computing jitter, or resampling non-uniform data./matlab-analyze-antenna-structuresDesign and analyze electrically large antenna structures using MATLAB Antenna Toolbox. Covers reflector antennas (parabolic, Cassegrain, Gregorian, offset, corner, cylindrical, spherical, custom STL), reflectarrays and reconfigurable intelligent surfaces (RIS), antennas installed on platforms (vehicles, aircraft, ships, satellites), and radar cross section (RCS) analysis. Includes solver selection (MoM-PO, PO, MoM, FMM), mesh control, and GPU acceleration. Use when the user wants to design a dish/reflector antenna, reflectarray, analyze an antenna on a platform, or compute RCS.
/matlab-analyze-emS-parameters, insertion loss, fields, currents, mesh control, and solver selection for RF PCB performance validation. TRIGGER: user asks to compute S-parameters, analyze insertion/return loss, extract fields or currents, compare MoM vs FEM, or control mesh for any RF PCB component. Invoke BEFORE writing sparameters() or solver code — API is non-obvious. SKIP: designing or creating components (use the specific matlab-design-pcb-* skill), material/stackup setup only (use matlab-manage-pcb-material), optimization sweeps (use matlab-optimize-pcb-design), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn)./matlab-analyze-pcb-pdnPDN DC voltage/current analysis, IR drop, design rule checking, and multi-net batch analysis on imported PCB layouts. TRIGGER: user asks about power integrity, PDN analysis, IR drop, voltage distribution, current density, power nets, or design rule checking on a PCB. Invoke BEFORE writing code — the PDN API chain is specialized and non-obvious. SKIP: importing a PCB file (use matlab-read-pcb-layout), EM field/S-parameter extraction (use matlab-analyze-em), material/stackup setup only (use matlab-manage-pcb-material), transmission line design (use matlab-design-pcb-transmission-line)./matlab-assemble-pcb-layoutBuild custom PCB structures with pcbComponent, shapes, Boolean ops, feeds, and multi-layer stackups for non-catalog geometries. TRIGGER: user asks to build, modify, or customize a pcbComponent — add/remove shapes, edit polygons, place feeds, add metal layers, cut slots, or create non-catalog RF structures. Also when modifying geometry of an existing catalog-designed component (e.g., adding pads, removing elements, editing vertices). Invoke BEFORE writing pcbComponent code — layer/shape/feed API is non-obvious. SKIP: designing catalog components like filters/couplers/txlines (use the specific matlab-design-pcb-* skill), material/stackup definition only (use matlab-manage-pcb-material), EM analysis (use matlab-analyze-em), importing PCB files (use matlab-read-pcb-layout)./matlab-design-antennaDesign antennas, arrays, and PCB antennas using MATLAB Antenna Toolbox. Covers catalog antenna design and pattern analysis, custom antenna construction (customAntenna + shape.*), PCB antenna design (pcbStack + antenna.*), finite and infinite array design, AI-accelerated design exploration (AIAntenna, patternFromAI), and optimization (SADEA/TR-SADEA). Use when the user wants to design, create, model, analyze, optimize, or fabricate an antenna or array.
Other plugins' skills for the same job