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®Hometab, click金宝appand choose a model template.

    Alternatively, if you already have the Library Browser open, click theNew ModelbuttonNew Model.

  • Open an existing model. To open recent models, on the MATLABHometab, click金宝app.

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

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 thestart_simulinkreference 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 theModelingtab, selectEnvironment>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®窗户®platforms with a窗户7certified or Windows 8 certified touch display andMacintoshplatforms with anAppleMagic Trackpad.

The editor supports additional shortcuts for scrolling that are unique to Simulink. Shortcuts and other interactive model building techniques are summarized inKeyboard Shortcuts and Mouse Actions for Simulink Modeling. For a tutorial, seeBuild 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 aFixbutton to apply these changes.

Simulink can detect block errors and warnings, such as:

  • GotoandFromblock mismatches.

  • Duplicate data store blocks. The value of theDuplicate data store namesparameter determines whether to display a warning or an error symbol.

TheErrors and Warningsoption is enabled by default. To turn off this option, in theDebugtab, selectDiagnostics>Edit-Time Errors & Warnings.

使用模型浏览器导航模型教主y 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 theModelingtab, selectEnvironment>模型浏览器. You can toggle the Model Browser display by clicking theHide/Show Model BrowsercontrolHide/Show Model Browser.

模型浏览器

In the Model Browser, you can specify whether to display blocks that are linked to a library or to masked subsystems. Click模型浏览器iconand selectLibrary LinksorSystems with Mask Parameters. For information on these types of blocks, seeLinked BlocksandMasking 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:

  • TheProperty 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

  • TheModel 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, seeSet Block Parameters.

Related Examples

Parameters

To support common user workflow tasks, tabs calledSimulation,Debug,Modeling,Format, andAppsprovide functionality corresponding to each task.

TheAppstab 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 aSubsystemblock, theSubsystem Blocktab appears. If you select a Stateflow chart, theState Charttab 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, seeCreate Custom Simulink Toolstrip Tabs.

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

Commands also appear oncontext 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.

TheHide/Show Explorer Barbutton in the upper left corner of the editor window displays a bar that shows where you are in the model hierarchy.

TheHide/Show Model Browserbutton displays the模型浏览器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.

  • 打开模型Explorer with theModel Workspacenode selected, click theModel Workspacelink.

  • 打开模型Explorer with theExternal Datanode for the model selected, click theExternal Datalink.

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

Programmatic Use

expand all

金宝appopens the Simulink Start Page. Select a model or template to open the Simulink Editor.

版本历史

Introduced before R2006a