Main Content

Simulink.createFromTemplate

Create model or project from template

Description

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 as either a numeric model handle or a currentProject object.

example

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

example

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 currentProject 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 string scalar or a character vector. If the template is not on the MATLAB® path, specify the fully-qualified path to the 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.createFromTemplate("mytemplate",Name="mymodel",Folder="C:\Workspace")

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

Data Types: char | string

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

Data Types: char | string

Output Arguments

collapse all

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

Version History

Introduced in R2016a