Manage Shadowed and Dirty Model Files and Other Project Files
When you use MATLAB® Projects, a project sets the environment on project startup and cleans the environment on project shutdown. The project also runs checks to identify shadowed model files and files with unsaved changes. For more information about the checks that run on project startup and shutdown, see Project Startup and Project Shutdown.
Identify Shadowed Project Files When Opening a Project
If there are two model files with the same name on the MATLAB path, then the file higher on the path is loaded, and the file lower on the path is shadowed. This shadowing applies to all models and libraries (SLX and MDL files).
A loaded model always takes precedence over unloaded models, regardless of its position on the MATLAB path. Loaded models can interfere when you try to use other files of the same name, especially when models are loaded but not visible. Simulink® provides a warning if you try to load a shadowed model when another model is already loaded and can cause conflicts.
The project checks for shadowed files when you open a project.
When you open a project, the project warns you if any models with the same name as your project models are already loaded. This check enables you to find and avoid shadowed files before opening any project models.
The Project Issues panel reports the Identify shadowed project files check fails.
In the Project Issues panel, use the options under the Fix button to save or discard and close the model that shadows project files. To avoid working on the wrong files, you must close the loaded models.
Tip
To help avoid problems with shadowed files, turn on the Simulink preference Do not load models that are shadowed on the MATLAB path. See Do not load models that are shadowed on the MATLAB path.
When you open a project with many referenced projects, identifying shadowed files can be time-consuming. You can disable this check. On the MATLAB Home tab, in the Environment section, click Settings. In the left pane, select MATLAB > Project. In the Project Startup section, clear Detect project files shadowed by open models.
To learn more about shadowed files, see Shadowed Files.
Find Models and Other Project Files with Unsaved Changes
You can check your project for models, data dictionaries, and MATLAB files with unsaved changes. In the Project toolstrip, in the Environment section, click Project Issues > Unsaved Changes.
In the Unsaved Changes dialog box, you can see all dirty project models, data dictionaries, and MATLAB files. The project only detects unsaved changes edited in the MATLAB and Simulink Editors. Manually examine changes edited in other tools. If you have referenced projects, files are grouped by project. You can save or discard all detected changes.
Manage Open Models and Data Dictionaries When Closing a Project
When you close a project, the project closes any project models or data dictionaries, unless they are dirty. For more information about the checks that run on project shutdown, see Project Shutdown.
When you close a project, if there are model files or data dictionaries with unsaved changes, a message prompts you to save or discard changes. You can see all dirty files, grouped by project, if you have referenced projects. To avoid losing work, you can save or discard changes by file, by project, or globally.
You can control this behavior on project shutdown. On the MATLAB Home tab, in the Environment section, click Settings. In the left pane, select MATLAB > Project. Then, adjust the settings in the Project Shutdown section.
To receive a warning about files with unsaved changes when you close a project, select Interrupt project close if there are dirty project files.
To automatically close project models when you close a project unless the project models contain unsaved changes, select Check for open project models and close them, unless they are dirty.
See Also
currentProject
| listStartupIssues
| listShutdownIssues
| runChecks