In the Simulink® start page, choose a template or search the templates.
Model templates are starting points to apply common modeling approaches. They help you reuse settings and block configurations and share knowledge. Use model and project templates to apply best practices and take advantage of previous modeling solutions.
Click the title of a template to read the description.
To locate templates that are not on the MATLAB search path, click Open. Model templates have the
After selecting the template you want, click Create Model.
To use a template without reading the description, click the template image. Alternatively, press Ctrl+N to use your default template. To set a default template, see Use Customized Settings When Creating New Models.
A new model using the template settings and contents opens in the Simulink Editor. For next steps, see Build and Edit a Model in the Simulink Editor.
If the built-in templates do not meet your needs, try searching on the Examples tab, or you can create your own templates. See Create a Template from a Model. On the Examples tab, enter search terms to find examples titles and descriptions of interest, or open further examples on the web by clicking View All next to a product name.
You can specify a model template to use for all new models.
Create a model with the configuration settings and blocks you want, then export the model to a template. See Create a Template from a Model.
To reuse these settings in every new model, make the new template your default
model template using the Simulink start page or the
In the start page, click the title of a template to expand the description, then click the down arrow next to Create Model and select Set As Default.
After you set a default model template, every new model uses that template, for example,
when you press Ctrl+N, when you use new model buttons, or
when you use
new_system. In the Simulink Editor, your default template name is at the top of the list when you select File > New >
The default template shows a tick mark in the start page.
On the MATLAB Home tab, click Simulink. In the Simulink Start Page, select a recent model or project from the list, or click Open.
In the Simulink Editor, select File > Open Recent and choose a recent model.
At the MATLAB command prompt, enter the name of the model without a file extension,
vdp. The model must be in the current folder or on the
MATLAB search path.
In the Simulink Library Browser, click the Open model or library button .
Open the model using the Current Folder browser or your operating system file browser.
Set favorites to easily get back to your favorite models and projects in the start page.
To edit or clear the list of recent files in the start page, right-click a recent file and use the context menu.
To open a model created in a later version of Simulink software in an earlier version, first export the model to the earlier version. See Export a Model to a Previous Simulink Version.
As you build models, you sometimes define variables for a model. For example, suppose
that you have a model that contains a Gain block. You can specify the variable
K as the gain rather than setting the value on the block. When you use
this approach, you must define the variable
K for the model to simulate.
You can use a model callback to load variables when you open a model.
In a model that uses the Gain block, set the block Gain value
Define the variable in a MATLAB script. In MATLAB, select New > Script. In the script, enter your variable definitions:
Save the script as
In the model, open the Property Inspector. Select View > Property Inspector. With no selection at the top level of a model, you can use the Property Inspector to set model properties. Otherwise, use File > Model Properties.
In the Callbacks section of the model properties, select
PreLoadFcn as the callback that you want to define. In the pane,
Save the model.
The next time that you open the model, the
PreloadFcn callback loads
the variables into the MATLAB workspace.
To learn about callbacks, see Callbacks for Customized Model Behavior. To define a callback for loading variables programmatically, see Programmatically Load Variables When Opening a Model.
If you open an MDL file that uses a particular character set encoding in a MATLAB session that uses a different encoding, a warning appears. For example,
suppose that you create an MDL file in a MATLAB session configured for
Shift_JIS and open it in a session
US_ASCII. The warning message shows the encoding of the
current session and the encoding used to create the model.
SLX files do not warn because they can store characters from any encoding.
If you encounter any problems with corrupted characters, for example when using
MATLAB files associated with the model, then try using the
slCharacterEncoding function to change the character encoding of the current
MATLAB session to match the model character encoding.
New models that you create have the
.slx extension by default. Models
created before R2012b have the extension
.mdl. Models you can edit can
.mdl extension, depending on when
they were created or whether you converted them. See Save Models in the SLX File Format.
.mdlp extensions denote protected models
that you cannot open and edit. See Protected Model. Model templates have the
Simulink libraries also use the
.slx extension, but you cannot
simulate them. To learn more, see Create a Custom Library.