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 bytemplatename. 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 returnsh, either a numeric model handle or asimulinkprojectobject.

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 (asimulinkprojectobject) 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*.sltxextension.

Example:

Data Types:char

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis 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 encloseNamein 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 asimulinkprojectobject.

版本历史

Introduced in R2016a