Simulink Import Data Into Data Dictionary
ASecurityImport data from JSON, Excel, CSV, or XML files, or other text files whose structure the user describes, into a Simulink Data Dictionary (SLDD), routing entries to Design Data or Architecture Data, and optionally attach the imported dictionary to a model. Helps choose code generation settings for dictionary entries: storage classes (Design Data), DataScope/HeaderFile (Architecture Data types), or MappedTo/Identifier (Architecture Data constants). Use when the user wants to import parameters, ...
- 1,443 stars
- 0 votes
- 0 copies
- 0 views
- Added December 4, 2026
Works with
Security analysis
100/100Pro scans all 10 files and shows the line behind each finding
npx -y skills add matlab/simulink-agentic-toolkit --skill simulink-import-data-into-data-dictionary --agent claude-codeAre you the author of Simulink Import Data Into Data Dictionary?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/matlab-simulink-import-data-into-data-dictionary)---
name: simulink-import-data-into-data-dictionary
description: >
Import data from JSON, Excel, CSV, or XML files, or other text files whose structure the user describes, into a Simulink Data Dictionary (SLDD), routing entries to Design Data or Architecture Data, and optionally attach the imported dictionary to a model. Helps choose code generation settings for dictionary entries: storage classes (Design Data), DataScope/HeaderFile (Architecture Data types), or MappedTo/Identifier (Architecture Data constants). Use when the user wants to import parameters, signals, buses, lookup tables, types, interfaces, constants, or variant objects into an SLDD, needs storage class, DataScope, or MappedTo guidance for dictionary entries, or mentions data dictionary import, architecture data, variant data, or calibration data management. Not for code mappings on a model's elements, authoring System Composer architecture models, attaching an existing dictionary or adding it to a project (simulink-manage-project), or restructuring existing dictionaries.
license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md
metadata:
author: MathWorks
version: "1.0"
---
# Simulink Data Dictionary Import Skill
Import external data into a Simulink Data Dictionary and save it, then save a reusable import script that prints example C code.
**Requires:** MATLAB R2023b or later, and the MATLAB MCP server connection (all dictionary operations are MATLAB commands).
**Requires (for Architecture Data):** System Composer license (for `Simulink.dictionary.ArchitecturalData`).
## What the response shows
Every import response contains, in this order: the data sample (Phase 1), the field mapping as `source field → property` lines, including the type field (`objectType → Simulink class`) when the source has one (Phase 2), the `Routing Compliance Check:` block (Step 3.0), the import table (Phase 3), and, if a model was named, the attachment preflight result (Phase 1, step 3). The import does not wait for you to show them; a report after the save is fine. Never leave any of them out, even when told not to ask questions.
## When to Use
- User wants to import parameters, signals, buses, types, interfaces, constants, or variant objects into an SLDD
- User asks about storage classes, DataScope, or MappedTo for dictionary entries
- User mentions "data dictionary import", "SLDD", "calibration data", "architecture data", or "variant data"
- User wants to attach a dictionary to a model after import
## When NOT to Use
- Browsing, querying, reorganizing, or splitting existing dictionaries, or wiring dictionary references — this skill imports from an external file into one dictionary
- Working with model parameters directly (not through a dictionary), or exporting data FROM a dictionary
- Storage classes or code mappings on a **model's** interface, linking an Embedded Coder dictionary, or changing entries this conversation did not import — this skill sets them only on entries it imports
- Building or editing model structure → `simulink-build-model`
- Authoring a System Composer architecture **model** (components, ports)
- Attaching an existing dictionary or fixing "dictionary not found" with nothing to import → `simulink-manage-project`
- Configuring the model for code generation, generating code, or A2L/ASAP2 files
## Input
The user's message gives the path to a data file and, optionally, a **target Simulink model** to attach the dictionary to ("attach it to myModel", "for use with myModel.slx"). With no model named, there are no model operations: do not attach the dictionary to any model, not even the one that is open (`bdroot`, `gcs`). End by offering the command to attach it, without running it: `set_param('<model>', 'DataDictionary', '<dict>.sldd'); save_system('<model>')`.
**Source formats:**
- **Supported:** JSON, CSV, Excel (`.xlsx`/`.xls`, one or more sheets), and XML.
- **Other text formats** (YAML, INI, delimited or fixed-width text, …): show a raw sample and ask the user to describe the structure, then continue as usual.
- **MAT-files:** not this skill. Import nothing and point the user to the existing workflow: `importFromFile(getSection(dictObj,'Design Data'),'data.mat')`, or `importFromFile` on the Architecture Data object for types, interfaces, and constants.
- **Not supported:** other binary files (PDF, images, …) and an existing `.sldd` as the source. Say the format is not supported, import nothing, and suggest exporting the data to JSON, CSV, or Excel.
If the model cannot be found — the user says so (e.g., "open_system fails", "model not on path") or your own `load_system` call fails — state, in these words: "Model 'X' could not be opened — import will proceed without attachment." Then continue with normal import phases.
## Overview
Phases: **1 Ingest** (sample; model-attachment preflight if a model was named) → **2 Map** (field mapping) → **2.5 System Composer check** (if anything routes to Architecture Data) → **3 Verify** (routing check, import table, conflicts, validation) → **4 Execute and save** → **4.5 Model Attachment** (if a model was named, `references/model_attachment.md`) → **5 Script Generation** (always, `references/script_generation.md`) → **6 Storage class changes** (on the user's follow-up).
**Default: import and save.** Run every phase in order, write, save, and generate the script without waiting for a reply, and report as in *What the response shows*. Wait only when the user asks to review before the import: then show those items and write nothing until they reply. Never skip the mapping or verification steps.
**Never replace or destroy existing data by default** — replacing the dictionary already attached to a model, or overwriting a conflicting entry. A request to import, to attach, or not to ask questions is not a yes; an explicit instruction to overwrite or replace is. Keep the existing data (leave the model's current dictionary attached, skip the conflicting entries), import and save the rest, and end by reporting each one and asking: for each conflicting entry, **overwrite, skip (what was done), or rename**; for the model, whether to replace its dictionary. Only on that explicit instruction — in the request or a follow-up — do you overwrite or replace; then save the dictionary (and model) and update the script.
### Section Routing
Entries are routed to **Architecture Data** or **Design Data** based on object type:
| Object Type | Default Target | Override Allowed |
|---|---|---|
| `Simulink.AliasType` | Architecture Data | → Design Data |
| `Simulink.NumericType` | Architecture Data | → Design Data |
| `Simulink.data.dictionary.EnumTypeDefinition` | Architecture Data | → Design Data |
| `Simulink.Bus` (as DataInterface or StructType) | Architecture Data | → Design Data |
| `Simulink.ServiceBus` (ServiceInterface) | Architecture Data | — |
| `Simulink.ConnectionBus` (PhysicalInterface) | Architecture Data | — |
| Scalar numeric constant | Architecture Data | → Design Data (as Parameter) |
| `Simulink.Parameter` | Design Data | — (cannot go to Arch Data) |
| `Simulink.Signal` | Design Data | — (cannot go to Arch Data) |
| `Simulink.LookupTable` | Design Data | — (cannot go to Arch Data) |
| `Simulink.Breakpoint` | Design Data | — (cannot go to Arch Data) |
| `Simulink.VariantExpression` / `VariantControl` / `VariantBank` / `VariantBankCoderInfo` | Design Data | — |
| `Simulink.VariantConfigurations` | Design Data (R2026b+) | Configurations section (pre-R2026b) |
| `Simulink.ValueType` | Architecture Data | → Design Data |
The table lists every class this skill imports. Do not import entries of any other class (for example `Simulink.ConfigSet`, `Simulink.Variant`, or a custom class). List them by name and class in the import table as not imported, and import the rest.
**Architecture Data** shares one store with Design Data, so check name conflicts against the Design Data section regardless of target. Its entries have no CoderInfo — they use **DataScope/HeaderFile** (types) and **MappedTo/HeaderFile/Identifier** (constants). More in `references/archdata_api.md` → *Key Facts*.
**Phase 2.5 — System Composer check:** before routing anything to Architecture Data, check `~isempty(ver('systemcomposer'))`. If it is missing — or the user says so — say that Architecture Data needs System Composer, so those entries cannot be imported there, and offer to re-route them to Design Data.
**Bus to Architecture Data:** ask whether it is a **DataInterface** (port interface, `addDataInterface`) or a **StructType** (data type, `addStructType`).
---
## Phase 1: Ingest
1. **Read the file and determine its structure.** First read `references/ingest_examples.md` → *Format Tips* and apply the ones for this file: what to show per format (JSON, Excel, CSV, XML, other), multiple Excel sheets, section-separator rows, lookup tables built from stem rows, import order, and string types (`stringtype(N)`).
2. Present the sample to the user clearly. **CRITICAL: Show specific entry names and values from the actual data — never summarize with generic patterns.** Always include: file name/format, total entries/rows, all field names, and ALL entries listed by name with key property values (for files ≤20 entries show every entry; for larger files show at least 5). Name the rows that have empty cells and say which field is empty (e.g., "BoostPressure and WastegatePos have no Value — expected for signals").
See `references/ingest_examples.md` for format examples by object type.
3. **Model-attachment preflight**: If the user specified a target model, run steps 1–2 of `references/model_attachment.md` **now** and report the result alongside the data sample (read `DataDictionary` with `get_param` through `evaluate_matlab_code`; `model_query_params` cannot read it). If a **different** dictionary is attached, warn the user here — naming **both** the attached dictionary and the target — and say it stays attached unless they confirm the replacement (ask at the end).
---
## Phase 2: User-Defined Mapping
**IMPORTANT: Present the data sample (Phase 1) and the mapping request (Phase 2) together in a single response — never split them into separate turns.**
### Target properties (normalized format):
The fields, their meaning, and the per-type JSON shapes are in `references/matlab_api.md` → *Normalized Intermediate Format*. Required: `name` and `objectType` always; `value` for Parameters, LookupTables, and Breakpoints; `enumerals` for enumeration types. Everything else (dataType, storageClass, customStorageClass, identifier, min/max, unit, description, dimensions, enum defaultValue/storageType/addClassNameToEnumNames) is optional.
### Mapping conversation:
1. List source fields found in the file
2. Suggest likely mappings based on field names. Write each one as `source field → property` (e.g., `name → entry name`, `value → Value`, `codename → Identifier`) and name the object type to be created.
3. If the source has a type field (`objectType`, `Type`, `class`, …), map it explicitly — e.g., `Type → objectType` — and say that it selects the Simulink class for each entry. If no such field exists, infer from container structure and state the inference.
4. **Never change the declared objectType.** If data seems incomplete, flag it.
5. State the object type to create and the batch default storage class (default: Auto); the user can correct either after the import (Phase 6)
### Storage class coherence:
**Auto** does NOT support Identifier, HeaderFile, or DefinitionFile — if the data has an identifier field, propose Model default (or ExportedGlobal, or a custom storage class) instead of Auto. Map source fields for HeaderFile, DefinitionFile, Owner, StructName, GetFunction, SetFunction, or PreserveDimensions to `customAttributes` (`references/storage_classes.md`).
---
## Phase 3: Verification and Validation
### Step 3.0 — Routing Compliance Check (mandatory, visible)
Before presenting the import table, explicitly verify section routing for every entry:
```
Routing Compliance Check:
[1] "VehicleState" — Simulink.Bus → default: Architecture Data ✓
[2] "Kp_motor" — Simulink.Parameter → default: Design Data ✓
```
**Rules:**
1. Re-read the Section Routing table for each entry's object type
2. Apply the documented default — do NOT use any other heuristic
3. If current target doesn't match default and user hasn't overridden, correct it with `(corrected)`
4. If user overrode, mark with `(user override)` and preserve
5. This check must appear BEFORE the import preview table — never skip it, even when every entry goes to the same section
6. **Entries not explicitly overridden by the user stay at their default** — do not ask about them. Only the user's explicit requests change routing.
Then present the full import table, with a Target column when entries route to different sections.
### Validation rules (check before presenting):
**Read `references/validation_rules.md` and apply all 23 rules before presenting the import table** — Design Data, Architecture Data, and variant rules. These four are the most often missed:
- **Signals** cannot use Define, Const, or ConstVolatile — a signal is written at run time, so it cannot be a constant.
- **Architecture Data constants** must be scalar numeric — logical values are rejected.
- **Variant classes** have no CoderInfo or StorageClass (exception: an embedded `Simulink.Parameter` inside a VariantControl with `ValueType='Simulink.Parameter'`).
- **A VariantBank CoderInfo reference that cannot be resolved is a warning, not a blocking error** — say "Referenced VariantBankCoderInfo 'X' not found — import will proceed but the reference may be unresolved." and continue.
Flag each validation error individually with a specific message, per entry. An entry with a blocking error is never written: import the valid entries and list each skipped entry with its error and fix. If no entry is left to import, the response ends with the errors and how to fix them: no script, and no promise of one later.
### Conflict detection:
If a target dictionary is specified, check for name collisions against the Design Data section (covers both sections). List each conflict by name. When an Architecture Data entry collides with a Design Data entry, tell the user why: Architecture Data and Design Data share one name store, so a name used in one section is taken in the other. For each: overwrite, skip, or rename. For Architecture Data overwrites: `destroy()` first, then re-add.
---
## Phase 4: Execute Import
Execute MATLAB commands via the MCP server.
### Workflow:
1. **Open or create the target dictionary** — `open` errors on a missing file, so create it when `~isfile` (`references/matlab_api.md` → *Dictionary Operations*), then get the `'Design Data'` section.
2. **Create Design Data entries** — See `references/matlab_api.md` for commands per type.
**Value and DataType ordering (Design Data):** Store Value as plain double, then set DataType as string property. Never wrap the Value in a cast — not even `double()`. Architecture Data constants are the exception: their `DataType` is read-only and inferred from `Value`, so create them with a typed value, e.g. `addConstant('TempOffset', Value=int16(-40))` (`references/archdata_api.md` → *Constant Creation*).
**Variant classes:** create them in the order in `references/matlab_api.md` → *Variant Class Import Ordering*. For VariantConfigurations, detect the release first and use the method-based API (*Creating Simulink.VariantConfigurations*).
3. **Create Architecture Data entries** with `Simulink.dictionary.archdata.open('target.sldd')` — see `references/archdata_api.md`. **Always name the exact `add*` method for each entry** in the execution plan or code preview (list in *Key Facts*).
4. **Offer `show(dictObj)` for inspection** — do not call it yourself: its window blocks MATLAB with no display.
5. **Save the dictionary** right after the writes: `saveChanges(dictObj)` (Design Data) and `archObj.save()` (Architecture Data). Say which file was saved. If a save fails or MATLAB cannot execute, say the changes are not saved — never claim a save that did not happen.
6. If a target model was specified, attach the dictionary — see `references/model_attachment.md`. The checks already ran in Phase 1, step 3: do not repeat them or raise a conflict for the first time here. Attach with the `model_edit` tool (`configure` op on `config:<model>`), then save the model.
7. **Generate the import script** `import_to_<dictname>.m` — do not ask first — following `references/script_generation.md`: write and save it, run it against a scratch dictionary, and show its output, which ends with example C code for sample entries. Generate it only when at least one entry was actually created; if validation blocked every entry, or every write failed, do not mention a script at all.
---
## Phase 6: Storage Class Changes
When the user follows up with storage class changes for imported entries: validate (Phase 3 rules), update and save the dictionary and the script, and show the new C code — `references/script_generation.md` → *Step 5*. Never move or re-create an entry to fit a change with no direct equivalent; leave it and ask at the end.
---
## Storage Class Selection Assistant
When the user asks for help choosing a storage class, guide them through intent-based questions. Read `references/storage_classes.md` for the decision tree — it is the only copy; follow it rather than recalling one.
Always show the generated C code that would result. Always warn that custom storage classes require ERT-based system target file.
---
## Verify Advice in MATLAB Before Answering
When you recommend code-generation settings (storage class and custom attributes, Architecture Data `DataScope`/`MappedTo`/`HeaderFile`, variant `ActivationTime` or `VariantBankCoderInfo`), first construct the object with those settings through `evaluate_matlab_code` — even if the user only asked a question — and report the outcome. Design Data and variant objects: in memory only. Architecture Data: in a scratch dictionary under `tempname`, never the user's. Never save during a check. How: `references/validation_rules.md` → *Verify Advice in MATLAB*.
---
## Architecture Data Guidance
Read `references/archdata_api.md` for decision trees, code generation previews, and construction patterns. **DataScope** (`'Auto'`, `'Exported'`, `'Imported'`, with HeaderFile — not CoderInfo or storage classes) applies to types, including enumerations, and DataInterfaces; **MappedTo** to constants; ServiceInterfaces and PhysicalInterfaces have neither. Never set **CppNamespace**.
---
## Reference Files
`references/`: `storage_classes.md`, `matlab_api.md`, `archdata_api.md`, `validation_rules.md`, `model_attachment.md`, `script_generation.md`, `ingest_examples.md`. `assets/code_preview_functions.m`: C preview functions for the script.
----
Copyright 2026 The MathWorks, Inc.
----
Files in this skill
- SKILL.md
- assets/code_preview_functions.m
- manifest.yaml
- references/archdata_api.md
- references/ingest_examples.md
- references/matlab_api.md
- references/model_attachment.md
- references/script_generation.md
- references/storage_classes.md
- references/validation_rules.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.