Main Content

Create Templates for Standard Project Settings

Using Templates to Create Standard Project Settings

In a project, use templates to create and reuse a standard project structure. Templates help you make consistent projects across teams. You can 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.

You can use templates to share information and best practices. You or your colleagues can create templates.

Create a template from a project when it is useful to reuse or share with others. You can use the template when creating new projects.

Create a Template from the Current Project

In a project, when you create a template, it contains the structure and all the contents of the current project, enabling you to reuse scripts and other files for your standard project setup. You can choose whether to include the contents of referenced projects in the template.

  1. Before creating the template, create a copy of the project, and edit the copy to contain only the files you want to reuse. Use the copy as the basis for the template.

    Note

    If the project is under version control, see instead Create a Template from a Project Under Version Control.

  2. On the Project tab, in the File section, select Share > Simulink® Template.

  3. On the Create Project Template dialog box, edit the name and author, select or create a group, and add a description to help template users.

  4. If you have referenced projects and want to export the referenced project files, then select the Include referenced projects check box.

  5. Click Save As. Choose a file location and click Save.

Create a Template from a Project Under Version Control

  1. Get a new working copy of the project. See Clone Git Repository or Check Out SVN Repository.

  2. To avoid accidentally committing changes to your project meant only for the template, stop using source control with this sandbox as you work on the template. In the Source Control view, under Available Source Control Integrations, select No Source Control Integration and click Reload.

  3. Remove the files that you do not want in the template. For example, you might want to reuse only the utility functions, startup and shutdown scripts, and labels. In the Files view, right-click unwanted files and select Remove from Project.

  4. On the Project tab, in the File section, select Share > Simulink Template and use the dialog box to name and save the file.

To verify that your template behaves as you expect, create a new project that uses your new template. See Create a New Project Using Templates.

Edit a Template

  1. Create a new project that uses the template you want to modify. See Create a New Project Using Templates.

  2. Make the changes.

  3. On the Project tab, in the File section, select Share > Simulink Template.

    Use the dialog box to create a new template or overwrite the existing one.

Remove a Template

To remove a template from the Simulink start page:

  1. Browse to the template location specified in the template details.

  2. Delete the template or move it to another location.

Explore the Example Templates

You can use the example templates as example structures for a new project.

You can explore the templates using the Simulink start page. To search for templates, use the start page search box. See Create a New Project Using Templates and Create a New Project from a Folder.

Related Topics