Using a Simulink Project with SVN
This example shows how to use a Simulink Project to manage the files within your design. Starting with an existing project that is already checked into 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.
- Setting Up the Example Files and Opening the Simulink Project Tool
- Managing the Project Path
- Managing Working Folders
- Startup and Shutdown Files
- Project Shortcuts
- Using Dependency Analysis
- Modifying Files
- Using The Modified Files View
- Viewing Project Information
- Viewing Source Control Information
- Using Project File Views
- Further Information
Setting Up the Example Files and Opening the Simulink Project Tool
Run the following commands to create and open a working copy of the project files.
Simulink.ModelManagement.Project.projectDemo('airframe', 'svn'); rebuild_s_functions('no_progress_dialog');
Creating sandbox for project. Created example files in "/private/tmp/BR2017bd_684186_4260/bml.batserve.044429/work/MATLAB/projects/slexamples/airframe1" Initializing: Project Path Setting up working folders Identifying shadowed project files Building with 'Xcode with Clang'. MEX completed successfully.
The project example copies files to a new folder so that you can edit them and use them under SVN version control.
The Simulink Project Tool opens and loads the project already under version control.
This project is configured to manage its folders on the MATLAB search path and some working folders.
Managing the Project Path
The Simulink 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 Simulink Project toolstrip tab.
Managing Working Folders
The Simulink Project enables the following working folders to be defined: the Simulink cache folder, the code generation folder and the current directory that is set when the project is loaded.
Click the "Details" button in the Simulink Project toolstrip tab to change any of thse working folders.
Startup and Shutdown Files
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 Simulink Project toolstrip tab.
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".
Using Dependency Analysis
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.
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 Simulink 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.
Using The Modified Files View
Click on Modified Files in the Views panel 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 Simulink Project toolstrip tab to commit your changes to Source Control.
The files stored in the .SimulinkProject folder are internal metadata files generated by your changes. The metadata allows you to add a label to a file without checking it out. You should never need to view metadata files directly. You should not need to review these files, but they are shown so that you know about all the files being committed to the source control system.
Viewing Project Information
Click the project tree node "Project: Simulink Project Airframe Example" to see information about the currently open project, including a description and the location of the project root folder.
Viewing Source Control Information
Select the main Simulink Project toolstrip 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, checked out), see the SVN column in the file management views.
Using Project File 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.