0
0
SimulinkHow-ToBeginner · 3 min read

How to Create a New Simulink Model Quickly and Easily

To create a new Simulink model, use the new_system command in MATLAB to initialize a blank model, then open it with open_system. Alternatively, you can create a new model from the Simulink start page by clicking Blank Model.
📐

Syntax

The basic syntax to create a new Simulink model in MATLAB is:

  • new_system('modelName'): Creates a new model with the specified name.
  • open_system('modelName'): Opens the created model in the Simulink editor.

If you omit the model name, MATLAB creates an unnamed model.

matlab
new_system('myModel')
open_system('myModel')
Output
A new Simulink model window named 'myModel' opens.
💻

Example

This example creates a new Simulink model named exampleModel and opens it for editing.

matlab
new_system('exampleModel')
open_system('exampleModel')
Output
A new Simulink model window named 'exampleModel' opens.
⚠️

Common Pitfalls

Common mistakes when creating new Simulink models include:

  • Not opening the model after creation, so the window does not appear.
  • Using invalid characters in the model name, which causes errors.
  • Forgetting to save the model, which can lead to loss of work.

Always use valid MATLAB variable names for model names and save your model after creation.

matlab
 % Wrong way: Using invalid name
new_system('123model') % This will cause an error

% Right way:
new_system('model123')
open_system('model123')
Output
Error using new_system Invalid model name '123model'. A new Simulink model window named 'model123' opens.
📊

Quick Reference

CommandDescription
new_system('modelName')Creates a new Simulink model with the given name
open_system('modelName')Opens the specified Simulink model in the editor
save_system('modelName')Saves the current Simulink model to disk
close_system('modelName')Closes the Simulink model window

Key Takeaways

Use new_system('modelName') to create a new Simulink model programmatically.
Always open the model with open_system('modelName') to view and edit it.
Choose valid model names that follow MATLAB variable naming rules.
Save your model after creation to avoid losing changes.
You can also create new models from the Simulink start page GUI.