
matlab-write-pcb-layout
Export pcbComponent designs to Gerber files with RF connectors and fab service formatting for PCB manufacturing. TRIGGER: user asks to export a PCB design to Gerber, generate manufacturing files, or write out a pcbComponent for fabrication. Invoke BEFORE writing export code — gerberWrite signature (pcbComponent, connectors, filename) is non-obvious. SKIP: importing/reading PCB files (use matlab-read-pcb-layout), building PCB geometry (use matlab-assemble-pcb-layout), EM analysis (use matlab-analyze-em), material/stackup setup (use matlab-manage-pcb-material).
- Installs
- 77
- 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-write-pcb-layout- 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-write-pcb-layout 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.
Writing PCB Layouts to Manufacturing Files
When to Use
- Exporting a pcbComponent or pcbStack design to Gerber manufacturing files
- Selecting and configuring RF connectors (SMA, SMB, MMCX, etc.) for PCB export
- Formatting output for specific fabrication services (OSH Park, Seeed, Advanced Circuits)
- Attaching RFConnector objects to catalog components for shielded analysis
- Generating a complete manufacturing package from a MATLAB RF design
When NOT to Use
- Importing Gerber files into MATLAB — use
matlab-read-pcb-layout - Building the PCB design itself — use
matlab-assemble-pcb-layoutor the designing skills - Running EM analysis — use
matlab-analyze-em
Typical Workflow
- Before: A design skill or
matlab-assemble-pcb-layout— create the pcbComponent;matlab-analyze-em— validate performance;matlab-optimize-pcb-design— tune if needed - This skill: Export to Gerber with connectors and fab formatting
Quick Reference
| Task | Code |
|---|---|
| Export Gerber files | [A,g] = gerberWrite(pcb, W, {C1,C2}) |
| SMA connector | C = PCBConnectors.SMA_Cinch |
| Edge-launch SMA | C = PCBConnectors.SMAEdge_Samtec |
| PCB service writer | W = PCBServices.OSHParkWriter |
| Customize writer | W.Filename = 'name'; W.CoordUnits = 'mm' |
| RF connector object | rc = RFConnector |
| Design connector for PCB | rc = design(RFConnector, pcb) |
gerberWrite — Export to Manufacturing
The gerberWrite function generates manufacturing files from a pcbComponent.
Basic Export
p = pcbComponent; % Your designed component
W = PCBServices.OSHParkWriter;
W.Filename = 'my_design'; % Controls output zip/folder name (default: 'untitled')
C1 = PCBConnectors.SMA_Cinch;
C2 = PCBConnectors.SMA_Cinch;
[A, outputPath] = gerberWrite(p, W, {C1, C2});
Output
gerberWrite produces a folder of Gerber and drill files:
- Top/bottom copper layers
- Solder mask layers
- Silkscreen layers
- Drill files
- Board outline
The A output is a PCBWriter object with export metadata. outputPath is the path to the generated files.
PCBWriter Object
The PCBWriter object controls export settings.
Properties
| Property | Description |
|---|---|
Design | Struct containing the PCB design data |
Writer | The PCB service writer (output format) |
Connector | Cell array of connector objects |
UseDefaultConnector | Use default connector if none specified |
ComponentBoundaryLineWidth | Outline line width |
PCBMargin | Extra board margin around component (m) |
Soldermask | 'both', 'top', 'bottom', or 'none' |
Solderpaste | Logical — generate solderpaste layer |
Font | Font for text on silkscreen |
PCBConnectors — Connector Catalog
Attach standard RF connectors to your exported board.
Available Connectors (25 Built-in Types)
| Category | Connectors |
|---|---|
| SMA 5-Pad | SMA, SMA_Cinch, SMA_Multicomp |
| SMA Edge-Launch | SMAEdge, SMAEdge_Cinch, SMAEdge_Samtec, SMAEdge_Amphenol, SMAEdge_Linx |
| SMB/SMC | SMB_Johnson, SMB_Pasternack, SMC_Pasternack, SMCEdge_Pasternack |
| MMCX | MMCX_Cinch, MMCX_Samtec |
| IPX/U.FL | IPX_Jack_Lighthorse, IPX_Plug_Lighthorse, UFL_Hirose |
| Coaxial Cable | Coax_RG11, Coax_RG58, Coax_RG59, Coax_RG174 |
| Semi-Rigid | Semi_020, Semi_034, Semi_047, Semi_118 |
Access via PCBConnectors.<type>. All connectors have common properties: Type, Mfg, Part, Annotation, Impedance (default: 50 ohm), Datasheet, Purchase.
5-pad properties: TotalSize, GroundPadSize, SignalPadDiameter, PinHoleDiameter, IsolationRing, VerticalGroundStrips
Edge-launch properties: GroundPadSize, GroundSeparation, GroundPadIsolation, SignalPadSize, SignalGap, SignalLineWidth, EdgeLocation ('north'|'south'|'east'|'west'), ExtendBoardProfile, FillGroundSide
Coax properties: PinDiameter, DielectricDiameter, ShieldDiameter, AddThermals, ThermalsDiameter, ThermalsBridgeWidth
Connectors are placed at feed locations during Gerber export. They define pad footprints and drill patterns.
PCBServices — Fabrication Service Writers
Writers configure output for specific fabrication services.
Available Services (5 Built-in Writers)
| Service | Description |
|---|---|
PCBServices.GerbLookWriter | GerbLook online viewer |
PCBServices.ZofZWriter | ZofZ 3-D Gerber viewer |
PCBServices.AdvancedCircuitsWriter | Advanced Circuits manufacturing |
PCBServices.SeeedWriter | Seeed Studio manufacturing |
PCBServices.OSHParkWriter | OSH Park manufacturing |
Each writer formats Gerber files according to the fab house's naming and layer conventions.
Key PCBServices properties: Filename, CoordUnits ('in'/'mm'), CoordPrecision, CreateArchiveFile, DefaultViaDiameter, UseExcellon, BoardProfileFile, SameExtensionForGerberFiles, PostWriteFcn, Files
% Customize a service writer
w = PCBServices.AdvancedCircuitsWriter;
w.Filename = 'my_antenna';
w.CoordUnits = 'mm';
w.CoordPrecision = [3 4];
RF Connectors
RFConnector models coaxial connectors (SMA, SMB, etc.) that attach to PCB structures.
rc = RFConnector;
rc.InnerRadius = 5e-4; % Center pin radius
rc.OuterRadius = 1.5e-3; % Outer conductor radius
rc.PinLength = 3e-3; % Pin insertion depth
rc.PinFootprint = 'Taper'; % 'Taper' or 'Circular'
rc.EpsilonR = 1.7341; % Dielectric fill permittivity
rc.Impedance = 50; % Characteristic impedance
Attaching to a Catalog Object
Attaching a Connector to a catalog object (e.g., microstripLine) requires IsShielded = true:
m = microstripLine;
m.IsShielded = true; % Required before setting Connector
m.Connector = RFConnector;
show(m);
Design for a pcbComponent
design() auto-tunes connector dimensions to match a PCB object. This requires an FEM-based pcbComponent — catalog objects like microstripLine do not support FEM:
pcb = pcbComponent; % Must be pcbComponent with SolverType='FEM'
pcb.SolverType = 'FEM';
rc = design(RFConnector, pcb);
Complete Design-to-Manufacturing Workflow
%% Design a filter
f = design(filterCoupledLine, 3e9);
%% Analyze
freq = linspace(1e9, 5e9, 101);
sp = sparameters(f, freq, 'SweepOption', 'interp');
rfplot(sp);
%% Export for manufacturing (convert to pcbComponent first)
pcb = pcbComponent(f);
W = PCBServices.OSHParkWriter;
C1 = PCBConnectors.SMA_Cinch;
C2 = PCBConnectors.SMA_Cinch;
[A, gPath] = gerberWrite(pcb, W, {C1, C2});
Pitfalls
-
Connector compatibility: Not all connectors work with all board thicknesses. SMA edge-launch connectors assume standard substrate heights. Check connector footprint dimensions match your board.
-
Gerber aperture limitations: Complex curved geometries may be approximated with polygons in Gerber format. Very fine features may lose resolution during export — check minimum feature size for your target fab service.
-
Multiple connectors need cell array: When passing multiple connectors to
gerberWrite, wrap them in a cell array:gerberWrite(pcb, W, {C1, C2}). An object array[C1, C2]will error. -
gerberWrite requires pcbComponent or pcbStack:
gerberWritedoes not work on catalog objects (e.g.,microstripLine,filterHairpin). Convert topcbComponentfirst if needed. -
Connector requires IsShielded on catalog objects. Setting
obj.Connector = RFConnectoron a catalog object (microstripLine, etc.) will error with "SolverType property must be set to 'FEM'" unlessobj.IsShielded = trueis set first. Catalog objects do not support FEM directly — useIsShielded = truefor MoM shielded mode.design(RFConnector, obj)only works withpcbComponentobjects that haveSolverType='FEM'. -
IsShielded + finite conductivity conflict. Setting
IsShielded = trueactivates an internal FEM-like solver path. If you also setConductor = metal("Copper")(finite conductivity), you will get "FEM solver does not support finite conductivity. Set conductivity of conductor to Inf." LeaveConductorat the default (PEC) when usingIsShielded = trueorConnector. -
gerberWrite on pcbcascade results.
pcbcascadereturns apcbComponent. This can be passed directly togerberWrite. However, verify the port count and connector count match — pcbcascade merges ports and removes connected ports, so the surviving port count may differ from the input components. -
IsShielded switches solver to FEM — affects sweep options. Setting
IsShielded = truechanges the internal solver to FEM. The'SweepOption', 'interp'interpolated sweep is designed for MoM and may not be available or behave differently with FEM. Run S-parameter analysis before addingIsShieldedfor export, or use a discrete frequency sweep with FEM.
Related Skills
matlab-read-pcb-layout— Import layouts from Gerber, ODB++, and Allegromatlab-assemble-pcb-layout— Building custom PCB structures from shapesmatlab-analyze-em— Running EM analysis before export
Copyright 2026 The MathWorks, Inc.
FAQ
What does the matlab-write-pcb-layout skill do?
Export pcbComponent designs to Gerber files with RF connectors and fab service formatting for PCB manufacturing. TRIGGER: user asks to export a PCB design to Gerber, generate manufacturing files, or write out a pcbComponent for fabrication. Invoke BEFORE writing export code — gerberWrite signature (pcbComponent, connectors, filename) is non-obvious. SKIP: importing/reading PCB files (use matlab-read-pcb-layout), building PCB geometry (use matlab-assemble-pcb-layout), EM analysis (use matlab-analyze-em), material/stackup setup (use matlab-manage-pcb-material).
How do I install matlab-write-pcb-layout?
Run npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-write-pcb-layout 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-write-pcb-layout/ (personal) or .claude/skills/matlab-write-pcb-layout/ (project).
Which AI agents can use matlab-write-pcb-layout?
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-write-pcb-layout 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-write-pcb-layout?
It is published by matlab in matlab/matlab-agentic-toolkit. It has 77 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-create-live-script
matlab/matlab-agentic-toolkit
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+.
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.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
ui-taste
uizze.sh
Give your coding agent better UI taste. Build and polish web and iOS interfaces with Uizze's anti-ui-slop playbooks and optional real-product references. Use for UI design, implementation, redesign, critique, or a final visual review in Claude Code, Codex, Cursor, or Copilot.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.