| Contents | Index |
| On this page… |
|---|
Use Templates for Standard Project Setup Create a Template from Your Current Project |
You can use templates to create and reuse a standard project structure. You can use templates to make consistent projects across teams. You could use templates to create new projects that:
Use a standard folder structure
Set up a company standard environment, for example, with company libraries on the path
Have access to tools such as company Model Advisor checks
Use company standard startup and shutdown scripts
Share labels and categories
When your existing project is in a state that others would find useful, or you want to reuse, then you can create a template from it and use it when creating new projects.
You can create a template from an existing project, then use the template to create new projects.
To create a template from your current project, select Simulink Project > Templates > Create Template.
To use the template when creating new projects, you must put the template on the template path. If the folder where you create the new template is not already on the template path, you can add folders to the path later in the Template Manager.
When you create a new template it contains the structure and all the contents of the current project, so that you can reuse scripts and other files for your standard project setup. Before creating the template, create and edit a new copy of the project to contain only the files you want to reuse, as described next.
To create a template from an existing project that is under version control:
Get a new working copy of the project. See Retrieve a Working Copy of a Project from Source Control.
To avoid accidentally committing changes to your project that you have made only to create the template, you might want to stop using source control with this sandbox. In the Source Control view, click Select an available source control integration and select None to remove this sandbox from source control.
Remove the files that you do not want in the template. For example, you may want to reuse only the utility functions, startup and shutdown scripts, and labels. In the Project Files view, right-click unwanted files and select Remove From Project.
Select Simulink Project > Templates > Create Template.
To verify that your template behaves as you expect, create a new empty project that uses your new template.
To make changes to an existing template:
Create a new empty project using the template you want to modify.
Make the desired changes to the project.
Select Simulink Project > Templates > Create Template.
Either create a new template, or overwrite the existing template.
Use the Template Manager to view a default template, or locate and validate template files. Select Simulink Project > Templates > Template Manager.
Click the default template in the Templates pane to view the Description.

The default template shows you how to specify options to:
Set up and reset the folders on the path when you open or close the project.
Define the location of the folder (slprj) for generated code and other temporary files.
Run standard scripts at start up and shut down.
Include information in a template about names, authors, and description
In the Template Manager you can:
Validate that a template is usable to create new projects.
Add folders to the template path to make templates visible in the New Project dialog Templates list.
Specify which templates to make visible in the Templates list.
To try using the default template, leave it selected when creating a new project.
Use the Templates list to select a template during project creation. Only templates on the template path appear in the dialog.
Note If you create a project in a folder that already contains files, you are warned if there are any collisions with the template. The template will overwrite the existing files if you choose to continue. |
You can use templates to share information and best practices. New templates could be created by you, your colleagues, or downloaded from MATLAB Central.
You need to import a new template to make it available for use in new projects.
Select Simulink Project > Templates > Template Manager.
Click Import.
Browse to the zip file that contains the new template.
Select a location on the template path to save the new template. Click Import to validate the template and import it. If validation fails, then it will not be imported.
![]() | Review Changes and Commit Modified Files | Export Projects | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |