Managing Simulink Projects
MATLAB projects coordinate Simulink workflows — they manage the MATLAB path (which Simulink uses to resolve model references, data dictionaries, and requirements), track file membership for source control, and provide label-based automation for selecting targets in CI/CD pipelines.
When to Use
- Creating a new MATLAB project for Simulink models
- Adding models, data dictionaries, or requirements to an existing project
- Configuring project paths so Simulink can resolve references
- Setting up labels for automation (test selection, code generation targets)
- Configuring source control and cache folders
- Diagnosing broken model references, missing dictionaries, or failing project health checks
When NOT to Use
- Building or editing model structure (blocks, connections) → use
building-simulink-models
- Writing or running tests → use
testing-simulink-models
- Drafting requirements content → use
generate-requirement-drafts
- Running simulations for analysis → use
simulating-simulink-models
Mental Model
Four principles that prevent the most common failures:
Registration ≠ path. addFile registers a file with the project for source control tracking. addPath puts a folder on the MATLAB path so Simulink can resolve artifacts by filename. These are independent operations — you almost always need both.
Filename-only resolution. Data dictionaries (set_param(...,'DataDictionary',...), addDataSource), model references, and requirements all resolve via MATLAB path using filename only — never full paths. The containing folder must be on the project path.
addPath is not recursive. Each subfolder containing resolvable artifacts needs its own addPath call.
Single-project constraint. Only one project can be open at a time. Creating or opening a new project silently closes the current one (running its shutdown scripts). currentProject throws an error when no project is open — it does not return empty.
Guardrails
Always:
- Use
addPath(proj, folder) for every folder containing dictionaries, referenced models, requirements, or profiles
- Pass filename only (not full paths) to
addDataSource, set_param(...,'DataDictionary',...), and slreq.createLink
- Use absolute paths for
SimulinkCacheFolder and SimulinkCodeGenFolder: proj.SimulinkCacheFolder = fullfile(proj.RootFolder, 'work')
- Call
updateDependencies(proj) before querying proj.Dependencies
- Close the current project before creating or opening another
- Use
.graphml extension for DependencyCacheFile
- Use
.gitignore for excluding derived files from source control
- Add requirements folder to project path when linking requirements to models
- Register
.slmx link-store files with the project (guarded by isfile check)
Ask First:
- Deleting files from a project (
removeFile then disk delete)
- Modifying startup/shutdown scripts (affects all users who open the project)
- Changing project references (affects dependent projects)
Never:
- Use
proj.IgnoredFilePatterns — throws "Feature not supported" for all project types from createProject
- Use
cat.Labels — the correct property is cat.LabelDefinitions
- Use
'string' as a label DataType — valid types are 'none', 'char', 'double', 'integer', 'logical'
- Use
findFile (singular) for label queries in R2024a+ — use findFiles (plural). ONLY use findFile with R2023a/b
- Pass full file paths to filename-only APIs
- Attempt to open two projects simultaneously
- Use
clear all in startup scripts — it wipes the proj variable
Task Routing
| Intent |
Reference |
| Add files/folders to project, manage project path |
references/path-and-file-management.md |
| Set up labels for automation pipelines |
references/labels-and-automation.md |
| Link data dictionaries to models |
references/data-dictionaries.md |
| Configure model references across folders |
references/model-references.md |
Configure source control, cache folders, .gitignore |
references/source-control-and-caching.md |
| Diagnose broken references or health check failures |
Start with Verification below, then route to the relevant reference |
Verification
Run after every project modification:
results = runChecks(proj);
updateDependencies(proj);
deps = proj.Dependencies; % digraph
If runChecks reports issues, inspect which folders are missing from the project path — this is the root cause of most failures.
Copyright 2026 The MathWorks, Inc.
1---2name: managing-simulink-projects3description: Manages MATLAB projects for Simulink workflows: path management, file registration, labels, source control configuration, and project lifecycle. Use when creating projects, adding models/dictionaries/requirements to projects, configuring labels for automation, fixing broken model references, or setting up source control for Simulink artifacts.4license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/lic5---6
7# Managing Simulink Projects
8
9MATLAB projects coordinate Simulink workflows — they manage the MATLAB path (which Simulink uses to resolve model references, data dictionaries, and requirements), track file membership for source control, and provide label-based automation for selecting targets in CI/CD pipelines.
10
11## When to Use
12
13- Creating a new MATLAB project for Simulink models
14- Adding models, data dictionaries, or requirements to an existing project
15- Configuring project paths so Simulink can resolve references
16- Setting up labels for automation (test selection, code generation targets)
17- Configuring source control and cache folders
18- Diagnosing broken model references, missing dictionaries, or failing project health checks
19
20## When NOT to Use
21
22- Building or editing model structure (blocks, connections) → use `building-simulink-models`
23- Writing or running tests → use `testing-simulink-models`
24- Drafting requirements content → use `generate-requirement-drafts`
25- Running simulations for analysis → use `simulating-simulink-models`
26
27## Mental Model
28
29Four principles that prevent the most common failures:
30
311. **Registration ≠ path.** `addFile` registers a file with the project for source control tracking. `addPath` puts a folder on the MATLAB path so Simulink can resolve artifacts by filename. These are independent operations — you almost always need both.
32
332. **Filename-only resolution.** Data dictionaries (`set_param(...,'DataDictionary',...)`, `addDataSource`), model references, and requirements all resolve via MATLAB path using **filename only** — never full paths. The containing folder must be on the project path.
34
353. **`addPath` is not recursive.** Each subfolder containing resolvable artifacts needs its own `addPath` call.
36
374. **Single-project constraint.** Only one project can be open at a time. Creating or opening a new project silently closes the current one (running its shutdown scripts). `currentProject` throws an error when no project is open — it does not return empty.
38
39## Guardrails
40
41**Always:**
42- Use `addPath(proj, folder)` for every folder containing dictionaries, referenced models, requirements, or profiles
43- Pass filename only (not full paths) to `addDataSource`, `set_param(...,'DataDictionary',...)`, and `slreq.createLink`
44- Use absolute paths for `SimulinkCacheFolder` and `SimulinkCodeGenFolder`: `proj.SimulinkCacheFolder = fullfile(proj.RootFolder, 'work')`
45- Call `updateDependencies(proj)` before querying `proj.Dependencies`
46- Close the current project before creating or opening another
47- Use `.graphml` extension for `DependencyCacheFile`
48- Use `.gitignore` for excluding derived files from source control
49- Add requirements folder to project path when linking requirements to models
50- Register `.slmx` link-store files with the project (guarded by `isfile` check)
51
52**Ask First:**
53- Deleting files from a project (`removeFile` then disk delete)
54- Modifying startup/shutdown scripts (affects all users who open the project)
55- Changing project references (affects dependent projects)
56
57**Never:**
58- Use `proj.IgnoredFilePatterns` — throws "Feature not supported" for all project types from `createProject`
59- Use `cat.Labels` — the correct property is `cat.LabelDefinitions`
60- Use `'string'` as a label DataType — valid types are `'none'`, `'char'`, `'double'`, `'integer'`, `'logical'`
61- Use `findFile` (singular) for label queries in R2024a+ — use `findFiles` (plural). ONLY use `findFile` with R2023a/b
62- Pass full file paths to filename-only APIs
63- Attempt to open two projects simultaneously
64- Use `clear all` in startup scripts — it wipes the `proj` variable
65
66## Task Routing
67
68| Intent | Reference |
69|--------|-----------|
70| Add files/folders to project, manage project path | `references/path-and-file-management.md` |
71| Set up labels for automation pipelines | `references/labels-and-automation.md` |
72| Link data dictionaries to models | `references/data-dictionaries.md` |
73| Configure model references across folders | `references/model-references.md` |
74| Configure source control, cache folders, `.gitignore` | `references/source-control-and-caching.md` |
75| Diagnose broken references or health check failures | Start with Verification below, then route to the relevant reference |
76
77## Verification
78
79Run after every project modification:
80
81```matlab
82results = runChecks(proj);
83updateDependencies(proj);
84deps = proj.Dependencies; % digraph
85```
86
87If `runChecks` reports issues, inspect which folders are missing from the project path — this is the root cause of most failures.
88
89----
90
91Copyright 2026 The MathWorks, Inc.
92
93----