Main Content

Simulink.createFromTemplate

Create model or project from template

Description

example

Simulink.createFromTemplate(templatename) creates a model or a project from the template file specified by templatename. The new project is created in the default project folder.

example

h = Simulink.createFromTemplate(templatename) creates a model or a project from the template file and returns h, either a numeric model handle or a simulinkproject object.

example

h = Simulink.createFromTemplate(templatename,Name,Value) specifies additional options as one or more Name, Value pair arguments.

Examples

collapse all

Simulink.createFromTemplate('simple_simulation.sltx')

Create a project from a template, specify the name and root folder, and return the handle to the new project (a simulinkproject object) for manipulating it programmatically.

proj = Simulink.createFromTemplate('code_generation_example.sltx','Name','myProject','Folder','C:\Work\project1')

Input Arguments

collapse all

Template file name, specified as a character vector. If the template is not on the MATLAB® path, specify the fully-qualified path to the template file and *.sltx extension.

Example:

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:

Project root folder, if creating a new project, specified as a character vector.

Data Types: char

New model or project name, specified as a character vector.

Data Types: char

Output Arguments

collapse all

Handle to the new model project, returned either as a numeric model handle or a simulinkproject object.

Version History

Introduced in R2016a