Try an example Simulink® project to see how the tools can help you organize your work. Projects can help you manage:
Your design (model and library files,
other files, source code for S-functions, and data)
A set of actions to use with your project (run setup code, open models, simulate, build, and run shutdown code)
Working with files under source control (check out, compare revisions, tag or label, and check in)
The Airframe example shows how to:
Set up and browse some example project files under source control.
Examine project shortcuts to access frequently used files and tasks.
Analyze dependencies in the example project and locate required files that are not yet in the project.
Modify some project files, find and review modified files, compare to an ancestor version, and commit modified files to source control.
Explore views of project files only, modified files, and all files under the project root folder.
Run this command to create a working copy of the project files and open the project:
The project example copies files to your temporary folder so that you can edit them and put them under SVN source control.
The Simulink Project opens and loads the project. The project is configured to run some startup tasks, including changing the current working folder to the project root folder.
Alternatively, you can try this example project using Git™ source
control, by specifying
The following example shows the options when using SVN.
In Simulink Project, examine the Files view to manage the files within your project. When Project Files View is selected, only the files in your project are shown.
To see all the files in your sandbox, click the Project Files View button and select All Files View. This view shows all the files that are under the project root, not just the files that are in the project. This view is useful for adding files to the project from your sandbox.
To find particular files or file types, in any file view, type in the search box or click the Filter button. You can also search inside files.
Click the x to clear the search.
To view files as a list instead of a tree, click the List view button.
To sort files and to customize the columns, click the Organize view button at the far right of the search box.
You can dock and undock the Simulink Project into the MATLAB® Desktop. If you want to maximize space for viewing your project files, undock the Simulink Project. Drag the title bar to undock it.
You can use shortcuts to make scripts easier to find in a large project. View and run shortcuts on the Project Shortcuts toolstrip. You can organize the shortcuts into groups.
In this example, the script that regenerates S-functions is set as a shortcut so that a
new user of the project can easily find it. You can also make the top-level model, or
models, within a project easier to find. In this example, the top-level model,
slproject_f14.mdl, is a shortcut.
Regenerate the S-functions.
On the Project Shortcuts tab in the toolstrip, click the shortcut Rebuild Project's S-functions.
The shortcut file builds a MEX-file. If you do not have a compiler set up, follow the instructions to choose a compiler.
to explore how it works.
Open the top model.
On the Project Shortcuts tab, click the shortcut F14 Model to open the root model for this project.
To create shortcuts to access frequently used files, select the Files view, right-click a file, and select Create Shortcut.
You can also specify files to run at startup and shutdown. See Automate Startup Tasks.
Open and make changes to files and review changes.
Select Project Files View.
View folders using the tree view button, and then expand the
Either double-click to open the
find_top_models file for editing from the
Simulink Project, or right-click and select
Make a change in the Editor, such as adding a comment, and save the file.
Under Files, select the Modified Files view. The files you changed appear in the list.
To review changes, right-click the
find_top_models file in the
Modified Files view and select Compare > Compare to Ancestor.
The MATLAB Comparison Tool opens a report comparing the modified version of the file in your sandbox against its ancestor stored in the version control tool. The comparison report type can differ depending on the file you select.
If you select a Simulink model to Compare > Compare to Ancestor, this command runs a Simulink model comparison.
To compare models, try the following example.
Select the Files view and expand the
Either double-click to open the
AnalogControl file for editing
from the Simulink Project, or right-click and select
Make a change in the model, such as opening a block and changing some parameters, and then save the model.
To review changes, right-click the file in the Modified Files view and select Compare > Compare to Ancestor.
The Comparison Tool opens a report.
In the Modified Files view, under Precommit actions, click Check Project to run the project integrity checks. The checks look for missing files, files to add to source control or retrieve from source control, and other issues. The checks dialog box can offer automatic fixes to problems found.
When you click a Details button in the Checks dialog box, you can view recommended actions and decide whether to make the changes.
For an example using the project checks to fix issues, see Upgrade Model Files to SLX and Preserve Revision History.
To check that all required files are in the project, run a file dependency analysis on the modified files in your project.
From the Simulink Project tree, select Dependency Analysis.
The Impact graph displays the structure of all analyzed dependencies in the project. The right pane lists required toolboxes and any problem files.
To view the files that use a problem file, hover over the messages under Problems and click Find All.
The graph updates to display only the problem file, and the problem message in the right panel. The file is not in the project. To view the dependencies of the problem file, on the Dependency Analysis tab, select Find > All Dependencies of Selection.
timesthree.mex64 is an S-function binary file required by
f14_airframe.slx. You can add binary files to your project or, as
in this project, provide a utility script that regenerates them from the source code
that is part of the project.
To remove the file from the problem files list, right-click the file and select Add External File. The next time you run a dependency analysis, the file does not appear as a problem file.
In this example, you do not want to add the binary file to the project, but instead use the script to regenerate the binary file from the source code in the project. Use Add External File to stop such files being marked as problems.
On the Dependency Analysis tab, in the Impact Analysis section, select Find > All Files.
In the Impact Analysis section, choose Select > Modified Files.
To view dependencies of the modified files, in the Impact Analysis section, select Find > All Dependencies of Selection.
After you modify files and you are satisfied with the results of the checks, you can commit your changes to the source control repository.
In the Modified Files view, under Precommit actions, click Check Project to make sure that your changes are ready to commit.
Observe that the Modified Files list includes a
The files stored in the
are internal project definition files generated by your changes. These
definition files allow you to add a label to a file without checking
it out. You do not need to view the definition files directly unless
you need to merge them, but they are listed so you know about all
the files being committed to the source control system. See Project Definition Files.
To commit your changes to source control, click Commit.
Enter a comment for your submission, and click Submit.
Watch the messages in the status bar as the source control commits your changes.
To view and edit project details, on the Simulink Project tab, in the
Environment section, click Details. View
and edit details such as the name, description, project root, startup folder, and
generated files folders such as the
To view details about the source control integration and repository location, on the Simulink Project tab, in the Source Control section, click SVN Details. This Airframe example project is under the control of the SVN source control tool.
Alternatively, use the project API to get the current project and the root folder:
project = simulinkproject; projectRoot = project.RootFolder;
For next steps, see Project Management.