Main Content

Simulink.exportToTemplate

Create template from model or project

Description

templatefile = Simulink.exportToTemplate(obj,templatename) creates a template file (templatename.sltx) from a model or project specified by obj.

If you have project templates created in R2014a or earlier (.zip files), use Simulink.exportToTemplate to upgrade them to .sltx files, then you can use them in the start page.

example

templatefile = Simulink.exportToTemplate(obj,templatename,Name,Value) specifies additional template options as one or more Name, Value pair arguments.

example

Examples

collapse all

Open the vdp model and create a template from it.

openExample('vdp.slx');
myvdptemplate = Simulink.exportToTemplate(bdroot,'vdptemplate')

Open the vdp model and create a template from it, specifying a description.

openExample('vdp.slx');
myvdptemplate = Simulink.exportToTemplate(bdroot,'vdptemplate',...
                'Description','Use this template to create a vdp model')

Input Arguments

collapse all

Model, library, or project, specified by name or numeric handle, or a slproject.ProjectManager object returned by the currentProject function.

Data Types: double | char

Template file name, specified as a character vector that can optionally include the fully-qualified path to a template file and *.sltx extension.

Data Types: char

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: Title,'My Project Template'

Group of template, specified as a character vector. On the Start Page, templates are shown under group headings.

Example: 'My Templates'

Data Types: char

Author of template, specified as a character vector.

Data Types: char

Description of template, specified as a character vector.

Data Types: char

Thumbnail image file name, specified as a character vector.

Data Types: char

Title of template, specified as a character vector. On the Start Page, the templates titles are shown on the tiles. The title can be different from the file name, and you can use any characters in the title. The default value is the name of the model or project.

Example: 'My Project Template'

Data Types: char

Output Arguments

collapse all

Template file, returned as templatename.sltx file.

Version History

Introduced in R2016a