Using Simulink    

Creating a Subsystem by Grouping Existing Blocks

If your model already contains the blocks you want to convert to a subsystem, you can create the subsystem by grouping those blocks:

  1. Enclose the blocks and connecting lines that you want to include in the subsystem within a bounding box. You cannot specify the blocks to be grouped by selecting them individually or by using the Select All command. For more information, see Selecting Multiple Objects Using a Bounding Box.
  1. For example, this figure shows a model that represents a counter. The Sum and Unit Delay blocks are selected within a bounding box.

    When you release the mouse button, the two blocks and all the connecting lines are selected.

  1. Choose Create Subsystem from the Edit menu. Simulink replaces the selected blocks with a Subsystem block.
  1. This figure shows the model after you choose the Create Subsystem command (and resize the Subsystem block so the port labels are readable).

If you open the Subsystem block, Simulink displays the underlying system, as shown below. Notice that Simulink adds Inport and Outport blocks to represent input from and output to blocks outside the subsystem.

As with all blocks, you can change the name of the Subsystem block. You can also customize the icon and dialog box for the block using the masking feature, described in Creating Masked Subsystems.

Undoing Subsystem Creation

To undo creation of a subsystem by grouping blocks, select Undo from the Edit menu. You can undo creation of a subsystem that you have subsequently edited. However, the Undo command does not undo any nongraphical changes that you made to the blocks, such as changing the value of a block parameter or the name of a block. Simulink alerts you to this limitation by displaying a warning dialog box before undoing creation of a modified subsystem.

Model Navigation Commands

Subsystems allow you to create a hierarchical model comprising many layers. You can navigate this hierarchy, using the Simulink Model Browser (see The Model Browser) and/or the following model navigation commands:

Window Reuse

You can specify whether Simulink's model navigation commands use the current window or a new window to display a subsystem or its parent. Reusing windows avoids cluttering your screen with windows. Creating a window for each subsystem allows you to view subsystems side by side with their parents or siblings. To specify your preference regarding window reuse, select Preferences from the Simulink File menu and then select one of the following Window reuse type options listed in the Simulink Preferences dialog box.

Reuse Type

Open Action


Go to Parent (Esc) Action

none
Subsystem appears in a new window.
Parent window moves to the front.
reuse
Subsystem replaces the parent in the current window.
Parent window replaces subsystem in current window
replace
Subsystem appears in a new window. Parent window disappears.
Parent window appears. Subsystem window disappears.
mixed
Subsystem appears in its own window.
Parent window rises to front. Subsystem window disappears.


  Creating a Subsystem by Adding the Subsystem Block Labeling Subsystem Ports