Skip to content

Dataset

MATLAB and Simulink code and model datasets for AI training

A MATLAB and Simulink dataset is a team's working files from the two products: MATLAB scripts, functions, live scripts and MAT-files, and Simulink models with their blocks, subsystems, signals, Stateflow charts, libraries, data dictionaries and test harnesses, plus generated C code where the team produces it. SourceX sources it to a buyer's spec from established businesses that run MATLAB and Simulink, such as controls, automotive and research engineering groups. Each dataset is de-identified and licensed for an agreed permitted use.

Dataset manifest

Sourced to your spec
What it is
MATLAB source, live scripts and MAT-files with Simulink models, libraries and data dictionaries, and the generated code trees built from them
Typical systems
MATLAB and Simulink with Stateflow, Simulink Coder, Embedded Coder and Simulink Test files; toolbox and blockset library content is referenced, not delivered
Typical history
Specified by the buyer; depends on whether the team kept its files under version control or as dated copies
Modality
Source code text, block diagrams as XML, numeric arrays in MAT-files and generated C source
Delivery formats
Agreed per order; files as saved, plus live scripts as plain code, MAT-files as HDF5 or Parquet and models as a JSON graph
Preparation
Author names, file paths, host names and customer project names removed from headers, model properties and generated-code comments
Licensing
Rights reviewed per repository for ownership and third-party code; the MathWorks license type the work was created under is a check for the owner and buyer; permitted use set in the license
Availability
Sourced to your spec by domain, toolbox use and whether generated code exists; supply is not guaranteed
CodeIllustrative

What a delivery contains

Fields vary by source system and are fixed per order. A typical delivery includes:

FieldTypeWhat it holds
artifact_idstringRe-keyed ID and relative path for one file: Script (.m), Function, Live script (.mlx), Simulink model (.slx), Data dictionary (.sldd) or MAT-file.
saved_releasestringThe release recorded in a Simulink model's package metadata, or stated by the supplier for code.
matlab_sourceobjectText of a Script or Function, with function signatures, the help comment block and the functions it calls.
live_script_partsarrayA Live script unpacked into code sections, formatted text and stored outputs.
blocksarrayEach Block in a Simulink model: BlockType, name, identifier, parent Subsystem and the parameter values that differ from the block default.
signalsarrayEach Signal line: source Block and port, destination ports, name, and compiled data type where the supplier ran the model.
stateflow_chartsarrayEach Stateflow chart: states, transitions with conditions and actions, data and events, plus MATLAB Function block code.
library_linksarrayBlocks linked to a Library and Model blocks that reference another model, with the target and whether it is in the delivery.
parameter_sourcesarrayVariables that Block parameters name and where each resolves: a Data dictionary entry, the model workspace or a base workspace variable set by a Script.
required_productsarrayMathWorks products and toolboxes the file needs, from the supplier's dependency analysis.
mat_variablesarrayPer MAT-file: file version and each variable's name, class and size, flagging MATLAB objects that outside readers cannot decode.
generated_codeobjectFor a model with a build folder: system target file, generated files, and the model version and generation time from their header comments.
test_harnessesarrayEach Test harness with the Subsystem it isolates and whether it is stored inside the model or as its own file.
Sample recordIllustrative

Field names from the table above; values are masked placeholders.

Example record

{
  "artifact_id": "art_7d20c4",
  "path": "ctrl/SpeedController.slx",
  "saved_release": "[RELEASE]",
  "blocks": [
    {
      "sid": "12",
      "block_type": "Sum",
      "name": "Error",
      "parent": "SpeedController/PI",
      "params": {
        "Inputs": "+-"
      }
    },
    {
      "sid": "14",
      "block_type": "Gain",
      "name": "Kp",
      "parent": "SpeedController/PI",
      "params": {
        "Gain": "Kp_speed"
      }
    }
  ],
  "signals": [
    {
      "src": "12#out:1",
      "dst": [
        "14#in:1"
      ],
      "name": "speed_err",
      "compiled_type": "single"
    }
  ],
  "stateflow_charts": [
    {
      "name": "ModeLogic",
      "states": [
        "Off",
        "Run",
        "Fault"
      ],
      "transitions": [
        {
          "from": "Run",
          "to": "Fault",
          "condition": "abs(speed_err) > errMax"
        }
      ]
    }
  ],
  "library_links": [
    {
      "sid": "23",
      "source_block": "ctrl_lib/RateLimiter",
      "in_delivery": true
    }
  ],
  "parameter_sources": [
    {
      "variable": "Kp_speed",
      "source": "data_dictionary",
      "file": "ctrl/CtrlData.sldd"
    },
    {
      "variable": "errMax",
      "source": "base_workspace",
      "set_by": "init_ctrl.m"
    }
  ],
  "generated_code": {
    "system_target_file": "ert.tlc",
    "build_folder": "SpeedController_ert_rtw",
    "files": [
      "SpeedController.c",
      "SpeedController.h",
      "SpeedController_data.c"
    ],
    "model_version_in_header": "1.142",
    "model_version_in_model": "1.142",
    "trace_sample": {
      "comment": "/* Gain: '<S2>/Kp' incorporates: Sum: '<S2>/Error' */",
      "statement": "rtb_Kp = SpeedController_P.Kp_speed * rtb_Error;",
      "block_path": "SpeedController/PI/Kp"
    }
  },
  "test_harnesses": [
    {
      "name": "PI_Harness1",
      "component": "SpeedController/PI"
    }
  ]
}

Synthetic record for illustration. Field names, structure and format are agreed per order.

What AI teams use it for

Train models to read block diagrams

Blocks, lines and Subsystem nesting parsed from the model package form typed graphs of real control and signal-processing designs.

Translate models to embedded C

A Subsystem beside the generated statements that trace back to it is a paired example of specification and code.

Fine-tune coding models on MATLAB

Scripts and Functions from working teams carry the matrix idioms and toolbox calls of production engineering work.

Learn mode logic from Stateflow

States, transitions and their conditions show how engineers encode startup, fault and recovery behavior.

Evaluate engineering agents

A Test harness with stored inputs and expected outputs checks whether an agent's change to a model still passes.

Use-case guides: Coding agents, Private evaluation sets, Robotics and embodied AI

What makes this data valuable

Models that update cleanly

The supplier's log shows each model updating with only the delivered files on the path.

Dependencies inside the delivery

Library links, referenced models and dictionary entries resolve to delivered files.

Code matches the model revision

Model version in the generated header equals the version stored in the model.

Simulation baselines kept

Harnesses come with logged inputs and expected outputs.

Readable source

Few P-code files, MEX binaries or protected models, and each one flagged.

Version control history

Commits show how models and scripts changed, not only their final state.

Process

MATLAB and Simulink dataset

This page covers MATLAB code and Simulink models.Illustrative

An .slx file opens without MATLAB, but simulates only with what it depends on

A Simulink model saved as .slx is a zip package of XML parts. Unzip it and the block diagram is there to parse: every Block with its BlockType, its name and a persistent identifier, every line with its source and destination ports, nested Subsystems, and metadata naming the release that saved the file. Stateflow charts, and the code inside MATLAB Function blocks, are stored in parts of their own. MathWorks says the content format of model files can change, so test a parser against every release in the delivery. The older .mdl format holds the same structure as plain text. A whole model library can be turned into graphs with a zip reader and an XML parser, without running MATLAB.

A Block generally carries only the parameter values that differ from its defaults, so a parsed Block looks half empty until the defaults for its type are filled in from elsewhere in the file or from the product. A parameter is usually an expression such as a variable name, not a number, and its value resolves when the model runs: from a Data dictionary, from the model workspace, or from the base workspace, where a startup script or a model callback put it. A Block linked to a Library is stored as a reference, and its contents are in the library file or, for MathWorks toolboxes and blocksets, in the vendor's installation and not in the delivery. Most signal data types, dimensions and sample times are set to inherit and exist only after Simulink compiles the diagram.

A structure-only corpus needs just the files. A runnable corpus needs the scripts, MAT-files, dictionaries, libraries, referenced models and toolboxes each model depends on, at a release that can open them. Ask the supplier to update each model in a clean session with only the delivered files on the path, and write the compiled types and sample times to a sidecar. MATLAB scripts have the same problem on a smaller scale: a script reads variables an earlier one left in the workspace, and a load call creates variables no line declares.

Generated C code gives each model an aligned source tree

Where a team uses Simulink Coder or Embedded Coder, building a model writes a build folder of C named after the model and its target, with shared utility code under a separate slprj folder. Inside are the model's source and header files, its step and initialize functions, and structures for inputs, outputs, states and parameters. Statements are commented with the Block they came from, in a short form such as <S3>/Gain, and a comment table in the model's header file expands each short system number to a full path. That is statement-to-block alignment between a graphical specification and its code, which a folder of scripts cannot offer.

The pairing holds only when the code came from the model revision delivered. By default each generated file's header comment records the model version and the time of generation, so compare them with the model. Build folders are outputs, and teams often leave them out of version control, so a tree can be stale or missing. The same model also yields different C under a different configuration: the system target file, hardware word sizes, inlined or tunable parameters, storage classes. Ask for the configuration set with every pair.

To test a sample, regenerate one model's code in the stated release and diff it against the delivered tree. Check that the block paths in the comments resolve to Blocks in the delivered model, since comment generation can be switched off. List P-code, MEX binaries and protected models, which run but cannot be read, and MAT-files that hold MATLAB objects, which readers outside MATLAB generally cannot decode.

What to check before licensing

  • Ask which MathWorks license type each body of work was created under. MathWorks sells academic, student and home licenses for narrower uses than its standard license, so have the data owner confirm theirs and take counsel's view on licensing the files.
  • Have the buyer and the data owner each check MathWorks' terms on files created with its products, on generated code and on reading its file formats outside MATLAB.
  • Confirm who owns customer-supplied models, plant models and calibration data, which often sit in the same repository as the team's own work.
  • Scan for code taken from File Exchange, toolbox examples and open-source projects, and read the license file that came with each.
  • Ask for a per-model log of an update run in a clean session, listing unresolved variables, broken library links and missing products.
  • For each generated code tree, compare the model version and generation time in the header comments with the delivered model.
  • Inventory files that cannot be read as source: P-code, MEX binaries, protected models, and MAT-files holding MATLAB objects.

Delivery No files move before a signed license. A listing or a request grants no files by itself.

How licensing works through SourceX

  1. 1

    Define

    Send the domain, modality, volume, format, timeline and permitted use you need.

  2. 2

    Source

    SourceX identifies businesses that hold matching data and are open to licensing it.

  3. 3

    Qualify

    Fit, rights and quality are checked, and you review samples before committing.

  4. 4

    License

    Scope, permitted use, exclusivity, price and obligations are agreed in writing.

  5. 5

    Deliver

    Approved data is prepared, de-identified where required and transferred securely.

Questions Acquisition Partners ask

Do I need a MATLAB license to use the data?

Not to read most of it. Scripts and Functions are plain text, an .slx model is a zip package of XML, and MAT-files can be delivered as open arrays. You do need MATLAB and Simulink, with the right toolboxes, to simulate a model, regenerate code or decode MATLAB objects saved in a MAT-file.

Can the Simulink models be simulated as delivered?

Only if their dependencies come with them. A model usually needs workspace variables from startup scripts or a Data dictionary, the Libraries its Blocks link to, any referenced models, and the toolboxes it uses. Ask the supplier for a log showing each model updating in a clean session.

How does generated C code line up with the model?

Through comments and naming that the code generator writes. Each generated statement can carry a comment naming the Block it came from, and the header holds a table from short system numbers to full Subsystem paths. The alignment is only valid when the code was generated from the delivered model revision, so compare the version in the header with the model.

Can MAT-files be read outside MATLAB?

Mostly, with one common exception. Numeric arrays, structures and cell arrays open in common scientific libraries, and Version 7.3 MAT-files use a format based on HDF5. MATLAB objects such as tables, timeseries and logged simulation outputs are stored in a form those libraries generally cannot decode. Ask for objects to be converted to plain arrays.

Does the license the work was created under matter?

It can, and it is the data owner's to confirm. MathWorks sells several license types, and its academic, student and home licenses are offered for narrower uses than the standard one. Ask which type each body of work was created under, and have counsel review what those terms mean for licensing the files. Check whether code taken from File Exchange carries its own license.

Is SourceX affiliated with MathWorks?

MATLAB and Simulink are named to identify the system the records come from. That does not imply a partnership with or endorsement by MathWorks. The records belong to the business that runs MATLAB and Simulink, which licenses them under a signed agreement, and a request does not guarantee a matching dataset. Buyers should still confirm with counsel that the vendor's terms allow the intended use of exported data.

Evaluating this data for procurement?

Diligence packets are prepared per dataset. Rights, privacy processing and quality differ between datasets.

Request dataset diligence

Tell us what your models need

Send your spec — domain, volume, format, timeline and permitted use — and SourceX will match it against partner data and come back with what can be licensed.

Updated 26 November 2026.

See if your company qualifies