This example shows how to use a project to manage the files within your design. Starting with an existing project that already uses source control, this example shows how to find and manage the files within your project. A common workflow illustrated by this example is fulfilling a change request for your design.
Run the following commands to create and open a working copy of the project files.
Simulink.ModelManagement.Project.projectDemo('airframe', 'git'); rebuild_s_functions('no_progress_dialog');
Building with 'gcc'. MEX completed successfully.
The project example copies files to a new folder so that you can edit them and use them under Git version control.
This project is configured to manage its folders on the MATLAB search path and some working folders.
The project defines a project path. Folders specified in the project path are added to the MATLAB search path at project start up and removed from the MATLAB search path when the project closes.
To edit or view this example's project path click the "Project Path" button in the Project toolstrip tab.
You can use the project to define the following working folders: the simulation cache folder, the code generation folder and the current directory when you open the project.
Click the "Details" button in the Project toolstrip tab to change any of these working folders.
Project files, such as MATLAB scripts, can be set to run when the project opens or closes.
To specify which project files are run during startup and shut down, click the "Startup Shutdown" button in the project toolstrip tab.
On the Manage Project Startup and Shutdown dialog box, you can specify to start Simulink on opening the project. You can also choose to refresh customizations (run sl_customization files) on project startup and shutdown.
Project shortcuts are shown in the "Project Shortcuts" toolstrip tab.
This example project has a shortcut for: the top-level mode, a utility function to rebuild s-functions and a design description document.
Click the shortcut "F14 Model" on the Project Shortcuts toolstrip tab to open the root model for this project.
Click the shortcut "Rebuild Project's S-functions" on the Project Shortcuts toolstrip tab to generate the S-Function.
To create new shortcut for a project file click the "New Shortcut" button on the Project Shortcuts toolstrip tab.
To edit a shortcut right click on a shortcut in the Project Shortcuts toolstrip tab and select "Edit Shortcut".
Run a file dependency analysis on the files within your project to check that all the files that are required by the project are stored with in it.
Click the Dependency Analysis node in the Views pane.
On the Dependency Analysis tab, click the Analyze button.
Review files reported in the Dependencies node. If problems are detected then all other results are filtered out. To see all the results of the file dependency analysis, click on the warning icon in the toolbar to turn off the "show only problem files" filter.
You can see from the results of the file dependency analysis that the S-Function binary, timesthree, is required by the project but is not currently part of it.
Click on timesthree in the Dependencies table to view where it is used within this project. In this example, it is used by f14_airframe.slx.
You may want to 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.
Right-click timesthree and select "Add External File". The next time you run dependency analysis, this file will not be marked as a problem file.
You can open files for editing from the project by double-clicking, or by right-clicking and selecting "Open".
Try opening and making changes to one of the utility MATLAB files, or one of the Simulink models.
Click on Modified filter in the Files view to see the files that you have modified in your working copy.
You can use the comparison tool from the project to understand the changes you have made, perhaps as part of a peer-review process.
Right-click a file in the Modified File view and select "Compare to Ancestor".
This launches an appropriate comparison using the MATLAB Comparison Tool, comparing the modified version of the file in your working copy against its ancestor stored in your version control tool. If you select a Simulink model this runs a Simulink® Model Comparison.
Click the commit button in the Project toolstrip tab to commit your changes to Source Control.
The files stored in the resources/project folder are internal project definition files generated by your changes. The project definition files allow you to add metadata to files, for example, by creating shortcuts, adding labels, and adding a project description. Project definition files also define the files that are added to your project. You can review changes in revisions of project definition files like any other project files.
Click the "Details" button in the Project toolstrip tab to see information about the currently open project, including a description and the location of the project root folder.
On the Project tab, the source control section contains buttons to perform source control operations such as commit. To see more information on the tool being used, click the details button in this section.
For source control information on individual files (for example modified, added), see the Git column in the file management views.
In the Files view, use the Project Files view to manage the files within your project. Only the files that are in your project are shown.
In the Files view, click the Project Files view button and select the All Files view to see all the files in your working copy. This 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 that exist within your working copy, but which are not yet part of the project.
In any file view, click the List button at the top right to view the files as a list.
Click the "cog" icon Actions button at the top right to customize the views and to sort files.
Right click the heading row of a file view to group files.