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:
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.
This figure shows the model after choosing the Create Subsystem command (and resizing 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. Also, you can customize the icon and dialog box for the block using the masking feature, described in Chapter 7, Using Masks to Customize Blocks.
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 Searching and Browsing Models) and/or the following model navigation commands.
The Open command opens the currently selected subsystem. To execute the command, choose Open from the Simulink Edit menu, type Enter
, or double-click the subsystem.
The Go to Parent command displays the parent of the subsystem displayed in the current window. To execute the command, type Esc
or select Go to Parent from the Simulink View menu.
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.
![]() | Creating a Subsystem by Adding the Subsystem Block | Labeling Subsystem Ports | ![]() |