Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create Templates for Standard Project Settings

Using Templates to Create Standard Project Settings

In Simulink® 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 Simulink 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.

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

  3. On the Create Template dialog box, edit the name and author, 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 in template 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 Retrieve a Working Copy of a Project from Source Control.

  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 Simulink Project tab, in the File section, select Share > 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 Simulink Project tab, in the File section, select Share > Template.

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

Explore the Example Templates

Example templates are supplied with Simulink Project. You can use these templates as example structures for a new project. The templates include:

  • The Blank Project template, which creates an empty project. Use this to manage existing files. As your project grows, the project helps you manage all your files as a unit. For example, the project can keep track of files as you add them, manage the path, provide shortcuts, run startup and shutdown scripts, help you rename and move files, warn you about shadowed files and unsaved changes, and optionally, add source control.

  • The Simple Project template, which creates a simple project containing a blank model. After you use the template to create the project, the model has a shortcut so that you can open it from the toolstrip. The project manages your path and the location of the temporary files (slprj folder) when you open and close the project. As your project grows, the project helps you manage all your files as a unit.

  • The Code Generation template, which shows how to get started with production code generation using plant and controller models. The controller settings are optimized for code efficiency. After you create the project, run the project shortcut "Generate Controller Code" to generate code and display a report.

      Tip:   If you want model templates suitable for code generation instead of the project template, try entering "code generation" in the start page search box.

    This template requires Simulink Coder™ and Embedded Coder®.

You can explore the templates using the Simulink start page. See Create a New Project Using Templates.

Related Topics

Was this topic helpful?