matlab/simulink-agentic-toolkit/create-sdi-run
Claude Code and agent skill by matlab/simulink-agentic-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Import data into the Simulation Data Inspector (SDI) from MAT, CSV, or Excel files, from workspace variables, or from a Simulink simulation. Use when the user wants to view a logged file in SDI, load a bench-test log, or verify what a just-completed `Simulink.sdi.createRun` or `sim(model)` produced. Covers the `'file'`, `'vars'`, and `'namevalue'` sources of `createRun`, the auto-populate behavior after `sim()`, and post-import verification. Not for comparing existing runs (use `Simulink.sdi.co…
Install
npx vskill@latest install matlab/simulink-agentic-toolkit/create-sdi-runSKILL.md
Create SDI Run
Get data into the Simulation Data Inspector using the shortest path that works. Most agents reflexively read files into the workspace and rebuild signals by hand; this skill teaches the direct paths and when each applies.
When to Use
- User has a
.mat,.csv, or.xlsxfile of logged data and wants to view it in SDI. - User just ran
sim(model)and wants to see the logged signals. - User has
timeseries,timetable, orSimulink.SimulationData.Datasetvariables in the workspace and wants an SDI run. - User asks about
Simulink.sdi.createRun,Simulink.sdi.getAllRunIDs, orSimulink.sdi.getRun.
When NOT to Use
- Comparing two existing runs — that is a distinct workflow (
Simulink.sdi.compareRuns). - Streaming data live during a running simulation — this is a separate API (
Simulink.sdi.createRunOrAddToStreamedRun), not a mode ofcreateRun. Prompts like "stream data into SDI while my sim is running" belong to that API. Do not activate on those. - Files in MDF (
.mf4), ULG, ROS bag, CAN log, or HDF5 formats — see references/format-support.md for what SDI reads natively vs. what needs a different toolbox. - Customizing plot layout, cursors, or subplot arrangement beyond opening the SDI window.
- Authoring Gherkin `.feature` files, Simulink Test cases, `matlab.unittest` classes, or any pass/fail assertions or regression tests for a model or subsystem — use
testing-simulink-models(Gherkin-basedmodel_test, requires Simulink Test). Prompts like "write a Gherkin test for X", "verify abs(-5) equals 5", "create a regression test for this subsystem", or any request whose deliverable is a test artifact belong there. Do not activate this skill on such prompts even whentesting-simulink-modelsis unavailable — in that case, tell the user which skill is missing and stop.
Workflow
Answer these four questions in order. The first "yes" tells you what to do.
1. Is the data already in SDI?
After sim(model) with signal logging enabled, SDI auto-populates one run. Do not call `createRun` — that produces a duplicate.
If no new run appeared, logging is off. Enable it via the Simulink Agentic Toolkit model_edit tool with a configure op setting DataLogging on the target port, then re-simulate — or fall back to Step 3 with simOut. As a last resort, ask the user to right-click a signal → Log Selected Signals in the Simulink editor themselves; that step is for the user to perform, not the agent.
2. Is the data in a file?
Use the 'file' source. One call handles MAT, CSV, and Excel natively — no load, no readtable, no sheetnames loop.
Excel with N sheets returns a 1×N `int32` vector — one run ID per sheet. All returned runs inherit the base name; if the user needs sheet-named runs, rename each run in place with sheetnames() — do not delete and re-import per sheet:
Time-column header rule (CSV and Excel). SDI's built-in reader requires the time column to be named literally time (case-insensitive). Headers like time_s, t, Time (s), Timestamp cause SDI:sdi:ImportError. Try `'file'` first and catch the error — do not pre-inspect the header row and guess, because SDI's matching rules can differ from your interpretation. On SDI:sdi:ImportError, fall back to the readmatrix + array2timetable + 'vars' pattern (Step 3 / CSV pattern below). Do not rewrite the source file.
Other `createRun` failures. createRun can also throw for reasons this skill does not enumerate — corrupted files, unsupported data types inside a MAT/Excel, malformed structs, permission errors, unregistered custom readers. When you catch an error identifier that is not SDI:sdi:ImportError, do not invent a fix or silently retry. Surface the full error identifier and message to the user, list the file or variables involved, and suggest they inspect the source (e.g., whos("-file",path) for a MAT, or sheetnames(path) plus a per-sheet read for an Excel). Ask before attempting an alternative import path.
3. Is the data in workspace variables?
Two sources, different purposes:
- `'vars'` — pass variables whose names or
.Nameproperties are already correct. This is the default. - `'namevalue'` — pass explicit signal names when the variables have no
.Namemetadata (e.g., bare arrays or unnamedtimeseries).
Timeseries whose .Name is already what you want:
Timetable — signals inherit the column names:
Bare arrays needing explicit names:
Gotcha (Gap E): if a timeseries passed to 'namevalue' has its own .Name set, .Name wins over the caller-supplied name. To force the name you want, either set ts.Name first and use 'vars', or clear it before 'namevalue'.
4. Verify the run
After every createRun or auto-populate:
Verify against MATLAB via the MATLAB MCP server's evaluate_matlab_code tool. If SignalCount == 0, the import silently produced nothing — investigate the source, do not report success.
Key Functions
All available from R2023a with base Simulink; no additional toolbox required.
| Function | Purpose | Available From | |
|---|---|---|---|
Simulink.sdi.createRun(name) | Empty run — used with Run.add for a per-signal build; rarely the right first choice. | R2011b | |
Simulink.sdi.createRun(name,"file",path) | Import a .mat, .csv, or .xlsx file. Returns scalar int32 for MAT/CSV, 1×N int32 vector for N-sheet Excel. | R2011b | |
Simulink.sdi.createRun(name,"vars",v1,v2,...) | Import workspace variables whose names/.Name are correct. | R2011b | |
Simulink.sdi.createRun(name,"namevalue",names,values) | Import with explicit names. See Gap E caveat. | R2011b | |
Simulink.sdi.view | Open the SDI window. Safe to call repeatedly; opens only if not visible. | R2011b | |
Simulink.sdi.getAllRunIDs | Return int32 vector of every run's ID. Use before/after sim to detect auto-populate. | R2017a | |
Simulink.sdi.getRun(runID) | Return the Simulink.sdi.Run object for a run ID. | R2011b | |
Simulink.sdi.clear | Delete all SDI runs. Ask the user first — destructive. | R2011b |
Four createRun sources exist: empty, `'vars'`, `'namevalue'`, `'file'`. When unsure, run help Simulink.sdi.createRun.
Patterns
Pattern: MAT file → SDI (one line)
The variables inside the MAT file may be timeseries, timetable, Simulink.SimulationData.Dataset, or legacy struct-with-time — SDI's reader picks them up automatically.
Pattern: CSV file → SDI (try 'file', catch, fall back)
Attempt the one-liner first. On SDI:sdi:ImportError, fall back to the timetable path — do not rewrite the file:
Assumes the time column is column 1 and expressed in seconds — the common case for bench logs. If the time column sits elsewhere or uses different units, adjust the index or wrap it with the appropriate duration constructor (milliseconds, minutes, …) before passing to RowTimes.
Pattern: Excel with multiple sheets → one run per sheet
One createRun call per file. Every returned run initially inherits the base name you supplied — SDI does not auto-apply sheet names. Rename in place with sheetnames(); do not delete and re-import per sheet. The same time-column-header rule applies as for CSV — if a sheet's time column is not named time, createRun throws SDI:sdi:ImportError; wrap this call in the same try-then-fallback shown in the CSV pattern, using readmatrix(...,"Sheet",sheets(k)) and readcell(...,"Sheet",sheets(k),"Range","1:1") per sheet.
To restrict to specific sheets, use the sheets name-value — the returned vector is trimmed accordingly:
Pattern: Post-sim — just open SDI
Pattern: Rename workspace signals
Set .Name before 'vars'. This avoids the 'namevalue' override trap.
Conventions
Always
- Check whether SDI already has the data before calling `createRun`. Use
Simulink.sdi.getAllRunIDsbefore and aftersim(model). If a new run appeared,simalready imported the logged signals — callSimulink.sdi.viewand stop. - Prefer the `'file'` source for
.mat,.csv,.xlsx. It handles the read and the signal-naming for you. Reserveload/readtable/sheetnamesfor the CSV time-column fallback and for genuinely workspace-first workflows. - Verify with `SignalCount`. After every import, confirm at least one signal exists. Zero signals means the import failed silently.
- Read `help Simulink.sdi.createRun` if you are unsure which source applies. The four sources are the entire API surface for import.
Ask First
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills-catalog/simulink-simulation/create-sdi-run/SKILL.md
Popularity
- Repository stars
- 1,035
- Repository forks
- 99
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/matlab/simulink-agentic-toolkit/create-sdi-run)