Main Content

Format a Model

As you build a model, you can adjust block positions, change block and background color, place block names and ports on any side of the block, 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 your model format:

Improve Model Layout

To improve your diagram layout and appearance, in the Format tab, click Auto Arrange. This option:

  • Aligns blocks in your model from left to right, starting with inputs and ending with outputs.

  • Resizes blocks, such as the Constant block, to display long parameter values.

  • Standardizes block size among similar blocks.

  • Straightens signal lines by moving blocks.

Alternatively, you can try improving the shapes of signal lines. To try to improve the shape of a single line, select it and, from the action bar, select Auto-route Line. The line redraws if a better route between model elements is possible.

You can try to improve multiple lines using Auto-route Lines. To access Auto-route Lines from the action bar, select either a block or multiple model elements using a drag box.

Flip or Rotate Blocks

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 input ports align with output ports 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 then, on the Format tab, click a Rotate icon in the Arrange section. You can rotate clockwise (Ctrl+R) or counterclockwise (Ctrl+Shift+R). Or click a Flip icon in the Arrange section. You can flip left-right or up-down, based on the orientation of a block's 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 click the rotate or flip icon. 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 Arrange option 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 clockwise.

    Block group select

    After you rotate the blocks and move them to fix overlapping, the model looks like this.

    After block rotate

    With the selection in place, in the toolstrip, click the Format tab and select Auto Arrange to improve the appearance of signal lines.

    After auto arrange

Port Location After Rotating or Flipping

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.

Default port rotation

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.

Physical port rotation

Flipping a block moves the ports to the opposite side of the block, creating a mirror image, regardless of port rotation type.

Manage Block Names and Ports

You can manage block names by displaying or hiding them and by changing their location on the block.


Copying and pasting blocks whose names follow numeric order (Gain1, Gain2, and so on) creates names that follow standard sorting order conventions for ASCII characters. This sorting order can result in a sequence of numbers on the block names that is hard to understand. If the numbering scheme is important to you, name your blocks explicitly such that copying and pasting them creates names that follow a typical reading order. To do so, use a leading zero in the block names, for example Gain001, Gain002, and so on.

Hide or Display Block Names

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. On the Format tab, select Auto > Hide Automatic Block Names to clear the option.

  • 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 Block Names setting. To explicitly hide or display a block name, select the block, then on the Format tab, select Auto 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 Block Names affects the block.

To display and hide block names programmatically, use set_param with the 'HideAutomaticNames' option for models and the 'HideAutomaticName' and 'ShowName' options for blocks. For more information on these parameters, see Common Block Properties. The table shows how these parameters interact.

'ShowName' (block setting)'HideAutomaticName' (block setting)'HideAutomaticNames' (model setting)Result
'off'AnyAnyName is hidden
'on''on''on'Name is hidden
'on''off'AnyName is shown
'on''on''off'Name is shown

Move Block Names

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:

  • Drag the block name to any side of the block.

  • Select the block and then on the Format tab click Flip Name.

Move Ports

You can put ports on any side in any order on these blocks:

  • Model block

  • Subsystem block

  • Subsystem Reference block

  • Stateflow® Chart

  • Stateflow Truth Table

  • Stateflow State Transition Table

You can move ports by clicking and dragging the port. For Subsystem blocks, the port index will automatically be renumbered after each move.

Specify Model Colors

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 input ports.

  • To change outline color on a block, text color in an annotation, or interior color for an area, select the element, and then, on the Format tab, select a color from the Foreground menu. 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, on the Format tab, select a color from the Background menu.

  • To change a background color in a system, open the system, and then on the Format tab, select a color from the Background menu.

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

Specify Fonts in Models

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. Some blocks display text according to the font style settings, and some blocks have fixed fonts and styles. To increase the font size of those blocks, zoom in.

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 specify font information on the Format tab.

  • To change the default fonts for the model, on the Format tab, click the Font Properties button arrow, then click Fonts for Model. Use the Font Styles dialog box to specify the font information.

You can also use the Property Inspector to change font for an area or an annotation.

Select Font Dialog Box on Linux Machines

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 

Increase Drop Shadow Depth

By default, blocks have a drop shadow. To make the block stand out more against the background, you can increase the depth of the drop shadow.

Select the blocks whose drop shadow depth you want to increase, and then on the Format tab click Shadow.


To remove the default drop shadow for all blocks, select the Simulink Editor preference Use classic diagram theme.

Box and Label Areas of a Model

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.

  1. Drag a box around the area of interest in the model. Or, drag on a blank area of the canvas to draw the area shape.

  2. From the action bar, select the option to create an area.

  3. 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.

  4. Optionally, add a description of the area contents using the Property Inspector.

  5. 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.

Convert Area to a Subsystem

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.

Copy Formatting Between Model Elements

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.

  1. Select the block, line, or area whose formatting you want to copy.

  2. From the action bar, select Copy Formatting. The cursor becomes a paintbrush.

  3. Using the paintbrush, click each element that you want to copy the formatting to.

  4. To cancel the paintbrush cursor, click a blank spot on the canvas or press Esc.

Related Topics