Main Content

Simulink Editor

Create models and set model properties

Description

The Simulink® Editor allows you to create and configure system models.

The Simulink Editor is a tool for building models. In addition to providing standard methods for working with diagrams in a vector graphics editor, the editor provides shortcuts that help you to add and connect blocks. The Simulink Editor also gives you access to the tools you need for technical operations such as importing data, simulating your model, and analyzing model performance.

Open the Simulink Editor

  • Create a model. On the MATLAB® Home tab, click Simulink and choose a model template.

    Alternatively, if you already have the Library Browser open, click the New Model button New Model.

  • Open an existing model. To open recent models, on the MATLAB Home tab, click Simulink.

    Alternatively, if you know the name of the model you want to open, enter the name in the MATLAB Command Window, such as vdp.

Tip

The first model that you open in a MATLAB session takes longer to open than subsequent models. By default, MATLAB does not start Simulink until you open the first model to reduce MATLAB startup time and avoid unnecessary system memory use.

To speed up opening the first model, you can configure MATLAB startup to also start Simulink. For more information on how to start Simulink without opening models or the Library Browser, see the start_simulink reference page.

Examples

expand all

When you build a model in the Simulink Editor, you use common techniques for working with graphics objects.

Actions you can perform in the Simulink Editor include:

  • Selecting using click, shift-click, and dragging

  • Resizing objects using handles and moving objects by dragging

  • Cutting, copying, and pasting

  • Undoing and redoing up to 101 operations

    Note

    After you undo or redo block parameter changes, a visual cue appears that shows the current values of the affected parameters. Some parameter changes are not affected by the undo or redo commands. After you undo or redo changes to block parameters, use the cue to see the parameters affected.

    A small subset of parameters cannot be undone. Changing these parameters clears the undo history when you make the change in the Property Inspector or in the block dialog box.

You can also zoom and scroll the editing area. On the Modeling tab, select Environment > Zoom, and select the zoom or view you want to use. If you are using a supported touch display platform, you can pinch to zoom and swipe to scroll. The supported touch display devices include Microsoft® Windows® platforms with a Windows 7 certified or Windows 8 certified touch display and Macintosh platforms with an Apple Magic Trackpad.

The editor supports additional shortcuts for scrolling that are unique to Simulink. Shortcuts and other interactive model building techniques are summarized in Keyboard Shortcuts and Mouse Actions for Simulink Modeling. For a tutorial, see Build and Edit a Model Interactively.

The Simulink Editor can provide you with visual cues for some model design issues. Highlighted blocks alert you to issues. To see a description of the issue, pause on a highlighted block and click the error or warning symbol.

Edit time error

Similar to the Diagnostic Viewer, if an error or warning has a predefined fix, the notification dialog box lists actions and may include a Fix button to apply these changes.

Simulink can detect block errors and warnings, such as:

  • Goto and From block mismatches.

  • Duplicate data store blocks. The value of the Duplicate data store names parameter determines whether to display a warning or an error symbol.

The Errors and Warnings option is enabled by default. To turn off this option, in the Debug tab, select Diagnostics > Edit-Time Errors & Warnings.

Use the Model Browser to navigate a model hierarchy using a tree structure. The browser helps you to understand the organization of your model and explore systems within systems.

To display the Model Browser, in the Simulink Editor, in the Modeling tab, select Environment > Model Browser. You can toggle the Model Browser display by clicking the Hide/Show Model Browser control Hide/Show Model Browser.

Model Browser

In the Model Browser, you can specify whether to display blocks that are linked to a library or to masked subsystems. Click Model Browser icon and select Library Links or Systems with Mask Parameters. For information on these types of blocks, see Linked Blocks and Masking Fundamentals.

As you build a model, you can set parameters and properties on model elements. For example, you can set parameters and properties for blocks that affect how the block functions. You can also set properties on Stateflow® charts, signal lines, visual elements such as annotations, and on the model.

Based on your workflow and goals, set parameters and properties using:

  • The Property Inspector, which stays open in the editor as you work and updates based on the current selection

  • A dialog box that is associated with an element, such as a specific block

  • The Model Data Editor, which stays open and displays information about signals, states, and algorithmic block parameters (for instances, gains and filter coefficients) in a table

For blocks whose parameter value appears on the block icon, you can select the block, pause on the value, and edit the value directly. For more information, see Set Block Parameters.

Related Examples

Parameters

To support common user workflow tasks, tabs called Simulation, Debug, Modeling, Format, and Apps provide functionality corresponding to each task.

The Apps tab provides a gallery of applications from the Simulink family of products. Apps may open a new contextual tab, a separate window, or they may be a shortcut to the configuration parameters.

After you open a gallery, you can mark buttons as favorites. Buttons that are favorites appear at the top of the gallery for quicker access. You can drag these buttons to reorder them.

When you select a model component, a contextual tab displays tools to assist you. For example, when you select a Subsystem block, the Subsystem Block tab appears. If you select a Stateflow chart, the State Chart tab appears. When the block or chart is no longer selected, the contextual tabs disappear.

The preferences folder saves the product-specific tabs that you have open for a model. Open tabs that require a license checkout do not persist after you close the model.

To add custom tabs to the Simulink Toolstrip, see Create Custom Simulink Toolstrip Tabs.

The quick access toolbar contains frequently used options such as save, undo, and redo. To customize the quick access toolbar, see Access Frequently Used Features and Commands in Simulink.

Commands also appear on context menus. Context menus appear when you right-click a model element or a blank area of the editor. For example, if you right-click a block, the menus display the commands relevant for working on blocks, such as clipboard and alignment operations. Some commands appear only on a context menu.

The palette along the left side of the editor provides shortcuts to commands you can use to modify the model appearance and navigate the model. For example, the palette includes a shortcut for adding annotations and other visuals, like boxed-in areas for labeling the model. It also provides a zoom button for zooming on a particular part of the model.

The Hide/Show Explorer Bar button in the upper left corner of the editor window displays a bar that shows where you are in the model hierarchy.

The Hide/Show Model Browser button displays the Model Browser pane. You can use this pane to view and navigate a hierarchical view of the model.

The icon in the lower-right corner opens additional views of the model. One such view is the interface view, which helps you to trace model interfaces. Click the control to see these views.

A badge in the lower-left corner indicates that a model has external data sources, such as a data dictionary, or that there is data in the model workspace. Click the badge, then use the menu to navigate to these data sources.

  • To open the Model Explorer with the Model Workspace node selected, click the Model Workspace link.

  • To open the Model Explorer with the External Data node for the model selected, click the External Data link.

  • To add or change a linked data dictionary, click the gear icon to open the External Data tab of the Model Properties dialog box.

Programmatic Use

expand all

simulink opens the Simulink Start Page. Select a model or template to open the Simulink Editor.

Introduced before R2006a