Skip to Main Content Skip to Search
Product Documentation

Use Templates to Create Standard Project Settings

Use Templates for Standard Project Setup

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:

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.

Create a Template from Your Current Project

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:

  1. Get a new working copy of the project. See Retrieve a Working Copy of a Project from Source Control.

  2. 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.

  3. 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.

  4. Select Simulink Project > Templates > Create Template.

  5. 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:

  1. Create a new empty project using the template you want to modify.

  2. Make the desired changes to the project.

  3. Select Simulink Project > Templates > Create Template.

    Either create a new template, or overwrite the existing template.

View and Validate Templates

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:

In the Template Manager you can:

Create a New Project Using a Template

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.

Import New Templates

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.

  1. Select Simulink Project > Templates > Template Manager.

  2. Click Import.

  3. Browse to the zip file that contains the new template.

  4. 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.

  


Related Products & Applications

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