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.

example

templatefile = Simulink.exportToTemplate(obj,templatename,Name=Value) specifies additional template options as one or more name-value 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, create a template from it, and specify 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 string scalar or a character vector. The filename can optionally include the fully-qualified path to a template file and *.sltx extension.

Data Types: char | string

Name-Value Arguments

collapse all

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.

Example: Simulink.exportToTemplate(bdroot,"modeltemplate",Description="Standard model template")

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

Example: "My Templates"

Data Types: char | string

Author of template, specified as a string scalar or a character vector.

Data Types: char | string

Description of template, specified as a string scalar or a character vector.

Data Types: char | string

Thumbnail image file name, specified as a string scalar or a character vector.

Data Types: char | string

Title of template, specified as a string scalar or a character vector. On the Start Page, the tiles show the templates titles. 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 | string

Output Arguments

collapse all

Full path of the template file (.sltx), returned as character vector.

Tips

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 the templates in the Start Page.

Version History

Introduced in R2016a