As you build a model, you can adjust block positions, change block and background color, adjust fonts, and add elements that help to improve model readability. These changes can help to organize the model visually and help others understand the model when you share it.
You can make these types of changes to improve model readability:
Flip or rotate blocks or groups of blocks. These adjustments help blocks to fit in the model and connect with other blocks. See Flip or Rotate Blocks.
Reposition or hide block names. See Manage Block Names.
Add colors to blocks and to the background. See Specify Model Colors.
Surround groups of blocks with a box to show that the blocks are related. See Box and Label Areas of a Model.
Copy formatting from a block, line, or area to another model element. See Copy Formatting Between Model Elements.
Document a model using text, image, and math annotations. See Describe Models Using Annotations.
Annotate a block. See Set Block Annotation Properties.
Change the block icon, for example, display a graphic on the block. Use a mask to achieve this effect. A mask also enables you to design a custom interface for a block. To learn about masks, see Masking Fundamentals.
You can change the orientation of a block or a group of blocks by rotating in 90-degree increments or by flipping. Rotate or flip blocks to fit better in the model, for example, in feedback loops. You might also need to rotate so that inports align with outports or to make better use of the model canvas.
The figure shows a Gain block flipped to simplify a feedback loop diagram.
To rotate or flip a block, select the block and select a command from the Diagram > Rotate & Flip menu. You can rotate clockwise (Ctrl+R) or counterclockwise.
With a single block selected, the Flip Block command flips the block based on the orientation of its ports. For example, if the ports are on the sides, the block flips left to right.
Blocks rotate when you place them on a signal line that has an orientation other than left to right. For example, if the signal goes from bottom to top and you place a block on it, the block rotates with its ports up.
To rotate or flip a group of blocks, select multiple blocks, and then select the rotate or flip command. The rotation or flip occurs as a group. The group of blocks flip only left to right when you flip blocks as a group.
After you rotate or flip a group of blocks, you can improve the readability of the model by editing the signal lines. The Auto-route Line command on the action bar might improve the appearance of signals. (For information on rotation with multiple ports, see Port Location After Rotating or Flipping.)
For example, suppose you rotate these selected blocks.
After you rotate the blocks and move them to fix overlapping, the model looks like this model.
In this case, select the line that connects the Gain block to the scope, and then select Auto-route Line to improve the shape of the signal line.
Rotating moves block ports from the sides to top and bottom or the reverse, depending on the placement of the ports. The resulting positions of the block ports depend on the block port rotation type.
Rotating can reposition the ports on some blocks to maintain left-to-right or top-to-bottom port numbering order. A block whose ports are reordered after a rotation have the default port rotation type. This policy helps to maintain the left-right and top-down block diagram orientation convention used in control system modeling applications. Blocks by default use this rotation policy. The figure shows the effect of clockwise rotation on a block with the default port rotation policy.
A masked block can specify for ports to keep their order after rotation (see Port rotation). These blocks have a physical port rotation type. This policy helps when designing blocks to use in mechanical and hydraulic systems modeling and other applications where diagrams do not have a preferred orientation. The figure shows the effect of clockwise rotation on a block with a physical port rotation type.
Flipping a block moves the ports to the opposite side of the block, creating a mirror image, regardless of port rotation type.
You can manage block names by displaying or hiding them and by changing their location on the block.
The Simulink® Editor names blocks when you create them. The first occurrence of the block is the library block name, for example, Gain. The next occurrence is the block name with a number appended. Each new block increments the number, for example, Gain1, Gain2, and so on. These names are called automatic names. By default, the Editor hides these names.
You can choose whether to hide or display block names. You can:
Display all the hidden automatic names. Select the Display menu, and clear the Hide Automatic Names check box.
Temporarily display a hidden automatic block name by selecting the block.
Name the block explicitly, for example, by its purpose in the model. The Hide Automatic Names setting does not affect blocks that you name explicitly. To name a block, select it, double-click the name, and type the new name.
In addition, you can explicitly hide or display any block name. Explicitly hidden or displayed blocks are not affected by the Hide Automatic Names setting. To explicitly hide or display a block name, select the block, select Diagram > Format > Show Block Name and then select:
On to always display the block name.
Off to always hide the block name.
Auto to return to the default state. If the block has an automatic name, Hide Automatic Names affects the block.
To display and hide block names programmatically, use
'HideAutomaticNames' option for models and the
'ShowName' options for blocks.
For more information on these parameters, see Model Parameters and
Common Block Properties.
The table shows how these parameters interact.
|Any||Any||Name is hidden|
|Name is hidden|
|Any||Name is shown|
|Name is shown|
By default, block names appear below blocks whose ports are on the sides and to the left on blocks whose ports are on the top and bottom. To change the location of a block name, you can:
You can specify the outline and interior colors of any block, and you can change the background color for any system in a model. You can also change text color and background color for annotations and fill color for areas.
This subsystem uses color to identify the inports.
To change outline color on a block, text color in an annotation, or interior color for an area, select the element, and then select Diagram > Format > Foreground Color. Changing the foreground color of a block also changes the color of its output signals.
To change interior color on a block or background color in an annotation, select the element, and then select Diagram > Format > Background Color.
To change a background color in a system, open the system, and then select Diagram > Format > Canvas Color.
You can select a color from the menu or select Custom to open the color picker and define your own color.
You can also use the Property Inspector to change color for an area or an annotation. To specify colors programmatically, see Specify Colors Programmatically
Change font family, style, and size for any model element to make your model easier to read or to comply with company standards. You can modify the font for selected blocks, signal labels, areas, and annotations. Changing a block’s font changes the font for the name and for text that appears on the block.
You can also change the default font for the model. The default font affects any elements whose font you have not changed and any new elements you create. If you want to use the same default font in all new models, change the default model font in your default template. See Use Customized Settings When Creating New Models.
To change the font of a block, signal label, area, or annotation, select the element, and then select Diagram > Format > Font Style for Selection. Use the dialog box to specify the font information.
To change the default font for the model, with no selection, select Diagram > Format > Font Style for Model. Use the dialog box to specify the font information.
You can also use the Property Inspector to change font for an area or an annotation.
On Linux® machines configured for English, the Font style list in the
Select Font dialog box can appear out of order and in another language in some fonts. If the
characters in your Font style list appear in another language, set the
LANG environment variable to
en_US.utf-8 before you
start MATLAB®. For example, at a Linux terminal, enter:
setenv LANG en_US.utf-8 matlab
Select the blocks whose drop shadow depth you want to increase, and then select Diagram > Format > Shadow.
To remove the default drop shadow for all blocks, select the Simulink Editor preference Use classic diagram theme.
Add an area to your model to visually group related model elements in a box. An area can move with the blocks it surrounds. You can add text to an area to briefly describe or label the area.
Drag a box around the area of interest in the model.
From the action bar, select Create Area.
Type the name of the area. The name appears in the upper-left corner of the area.
To enter the name later, select the area, click the ?, and start typing, or use the Name property in the Property Inspector.
Optionally, add a description of the area contents using the Property Inspector.
To move the area and its contents, drag the area near the border.
To move an area without moving its contents, hold Alt (option on a Mac) and drag.
Alternatively, you can drag an area box from the palette onto the canvas, resize the box, and move it to the desired location.
An area is similar to a subsystem in that it is a way to group related blocks. However, a subsystem creates a hierarchy, replacing multiple blocks in a model with a single block. You can initially group related blocks in an area and later decide to put those blocks in a subsystem by converting the area. The resulting subsystem has the same name, blocks, description, and requirements traceability information as the area.
To convert an area to a subsystem, right-click the area and select Create Subsystem from Area.
If you have applied formatting to a block, signal line, or area in a model, you can copy the formatting and apply it to another model element. Examples of formatting include font changes, foreground and background color, and drop shadow effects.
Select the block, line, or area whose formatting you want to copy.
From the ellipsis menu, select Copy Formatting. The cursor becomes a paintbrush.
Using the paintbrush, click each element that you want to copy the formatting to.
To cancel the paintbrush cursor, click a blank spot on the canvas or press Esc.