Matlab Read Pcb LayoutSAFE
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
Overview
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
58967e6f32b5OBSERVED · 2026-10-14What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
name: matlab-read-pcb-layout
description: "Import Gerber, ODB++, Allegro .brd, .mcm files for PCB boards and IC packages. Inspect nets, layers, shapes, and stackups. TRIGGER: user asks to import, read, or open a PCB layout file. Gerber files use gerberRead or PCBReader; ODB++, Allegro .brd, .mcm, and native formats use pcbFileRead. Also when inspecting nets, layers, components, or stackups from an imported board. Invoke BEFORE writing import code — the query API (cadnet, cadnetList, componentList) is specialized. SKIP: EM analysis or S-parameter extraction (use matlab-analyze-em), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn), building custom geometry (use matlab-assemble-pcb-layout), material/stackup definition only (use matlab-manage-pcb-material)."
license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md
metadata:
author: MathWorks
version: "1.0"
---
# Reading PCB and Package Layouts
**Scope:** `pcbFileRead` handles both PCB boards and IC/SiP packages. ODB++ and Allegro files may contain package-level designs (BGA substrates, interposers, embedded passives). The workflow is identical — the format determines what's inside, not the function name.
## When to Use
- Importing Gerber files (`.gtl`, `.gbl`, `.gbr`, etc.) into MATLAB for visualization or EM analysis
- Reading ODB++ archives (zipped or unzipped) to inspect board or package layouts
- Importing Cadence Allegro `.brd` files
- Inspecting cadnets, components, layers, pins, or shapes from imported layouts
- Extracting metal layer polygons from Gerber files for use in custom designs
- Building a `pcbComponent` from externally designed layouts for S-parameter analysis
## When NOT to Use
- Exporting designs to Gerber files — use `matlab-write-pcb-layout`
- Building PCB structures from scratch with shape primitives — use `matlab-assemble-pcb-layout`
- Running EM analysis after import — use `matlab-analyze-em`
- Defining substrates or stackup materials — use `matlab-manage-pcb-material`
## Typical Workflow
1. **This skill:** Import the PCB layout from Gerber, ODB++, or Allegro
2. **After:** `matlab-analyze-pcb-pdn` — PDN DC analysis on imported board; or `matlab-analyze-em` — S-parameter extraction from imported geometry; or `matlab-model-via` — via analysis on imported stackup
## Quick Reference
| Task | Code |
|------|------|
| Import Gerber file | `P = gerberRead('file.gtl')` |
| Extract shapes | `shp = shapes(P)` |
| Define stackup | `S = stackUp` |
| Multi-layer import | `p = PCBReader('StackUp', S)` |
| Convert to pcbComponent | `pcb = pcbComponent(p)` |
| Import ODB++ | `pfile = pcbFileRead('design.zip')` |
| Import Allegro .brd | `pfile = pcbFileRead('design.brd')` |
| List cadnets | `tbl = cadnetList(pfile)` |
| Open a cadnet | `cnet = cadnet(pfile, "NET_NAME")` |
| Query layer stackup | `su = stackUp(pfile)` |
| List components | `tbl = componentList(pfile)` |
| List padstacks | `tbl = padStackList(pfile)` |
## gerberRead — Simple Import
The `gerberRead` function imports Gerber files and returns a `PCBReader` object. Use `shapes()` to extract the metal layers as polygon shapes.
### Basic Usage
```matlab
P = gerberRead('interdigital_Capacitor.gtl');
shp = shapes(P); % Extract metal layer shapes
show(shp(1)); % Show top layer polygon
```
### Centering Imported Geometry
Imported shapes often have non-zero offsets from CAD origin. Extract shapes, then center:
```matlab
P = gerberRead('myDesign.gtl');
shp = shapes(P);
layer1 = shp(1);
% Get bounding box to compute center offset
verts = layer1.Vertices;
cx = (max(verts(:,1)) + min(verts(:,1))) / 2;
cy = (max(verts(:,2)) + min(verts(:,2))) / 2;
% Center using translate
layer1 = translate(layer1, [-cx -cy 0]);
show(layer1);
```
### Supported Gerber File Extensions
| Extension | Layer Type |
|-----------|-----------|
| `.gtl` | Top copper |
| `.gbl` | Bottom copper |
| `.gts` | Top solder mask |
| `.gbs` | Bottom solder mask |
| `.gto` | Top silkscreen |
| `.gbo` | Bottom silkscreen |
| `.drl` | Drill file |
| `.gbr` | Generic Gerber |
## stackUp — Multi-Layer Definition
The `stackUp` object defines the full PCB layer structure for importing multi-layer boards.
### Default stackUp
```matlab
S = stackUp;
```
A default stackup has numbered layers. Odd layers are conductors (metal or Gerber files), even layers are dielectrics.
### Assigning Gerber Files to Layers
```matlab
S = stackUp;
S.Layer1.Thickness = 0.1e-3; % Air layer above board
S.Layer2 = 'interdigital_Capacitor.gtl'; % Top copper from Gerber
```
### Multi-Layer Stackup
```matlab
S = stackUp;
S.Layer1.Thickness = 0.1e-3; % Air
S.Layer2 = 'top_copper.gtl'; % Top copper
S.Layer3.Thickness = 0.2e-3; % Dielectric
S.Layer3.EpsilonR = 4.4;
S.Layer4 = 'inner_layer.g2'; % Inner copper
S.Layer5.Thickness = 1.0e-3; % Core dielectric
S.Layer5.EpsilonR = 4.4;
S.Layer6 = 'bottom_copper.gbl'; % Bottom copper
```
## PCBReader — Full Board Import
`PCBReader` wraps the stackup with Gerber files into a reader object that can be converted to `pcbComponent`.
### Basic Workflow
```matlab
S = stackUp;
S.Layer1.Thickness = 0.1e-3;
S.Layer2 = 'interdigital_Capacitor.gtl';
p = PCBReader('StackUp', S);
pcb = pcbComponent(p);
pcb.FeedDiameter = 0.001;
show(pcb);
```
### Adding Feeds After Import
After converting to `pcbComponent`, add feed locations for EM analysis:
```matlab
pcb = pcbComponent(p);
pcb.FeedDiameter = 1e-3;
pcb.FeedLocations = [-5e-3 0 1 3; % Port 1
5e-3 0 1 3]; % Port 2
sp = sparameters(pcb, linspace(1e9, 10e9, 51), 'SweepOption', 'interp');
rfplot(sp);
```
### Determining Feed Locations from Imported Geometry
Feed locations must fall on metal traces. After converting a Gerber import to `pcbComponent`, inspect the geometry to find valid feed points:
```matlab
pcb = pcbComponent(p);
show(pcb); % Visual inspection — identify trace endpoints
layout(pcb); Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (0)
No findings outside the package's declared scope.
Gates applied: no_behavioural_pass.
58967e6f32b5full audit observations/trust-audit/skill/matlab__matlab-read-pcb-layout.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-14 | 58967e6f32b5 | SAFE | B | 89 | first audit |
Questions
What does the Matlab Read Pcb Layout skill do?
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
Is Matlab Read Pcb Layout safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Matlab Read Pcb Layout access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (58967e6f32b5), read on 2026-10-14. The repository is watched, and a new audit runs when it changes — this is the first audit.