| Contents | Index |
| On this page… |
|---|
Use the Icon & Ports pane to create block icons that can contain descriptive text, state equations, images, and graphics.

The Icon & Ports pane contains the controls described in this section.
The Icon Drawing commands text box allows you to enter code that draw the block icon. Use commands from the set of commands to display text, display one or more plots, or show a transfer function, as described in Mask Icon Drawing Commands.
You can use only these commands to draw your icon. The drawing commands execute in the order in which they appear in this field. Drawing commands have access to all variables in the mask workspace. If any drawing command cannot successfully execute, the icon displays three question marks.
You can include MATLAB comments at the end of a drawing command or on their own line, as in the following examples:
image(imread('engine.jpg')) % Use engine icon for subsystem% Use engine icon for subsystem
image(imread('engine.jpg')) The drawing commands execute when you:
Load the model.
Run or update the block diagram.
Apply any changes made in the Mask Parameters dialog box, either by clicking Apply or OK.
Apply any changes made in the Mask Editor, either by clicking Apply or OK.
Make changes to the block diagram that affect the appearance of the block, such as rotating the block.
Copy the masked block within the same model or between different models.
This pane demonstrates the usage of the various icon drawing commands supported by the Simulink product. To determine the syntax of a command, select the command from the Command list. An example of the selected command is displayed at the bottom of the pane and the icon produced by the command to the right of the list.
These controls allow you to specify the following attributes of the block icon.
The icon frame is the rectangle that encloses the block. You can choose to show or hide the frame by setting the Frame parameter to Visible or Invisible. The default is to make the icon frame visible. For example, this figure shows visible and invisible icon frames for an AND gate block.

The icon can be set to Opaque or Transparent, either hiding or showing what is underneath the icon. Opaque, the default, covers information the Simulink software draws, such as port labels. This figure shows opaque and transparent icons for an AND gate block. Notice the text on the transparent icon.

This option controls the coordinate system used by the drawing commands. It applies only to plot and text drawing commands. You can select from among these choices: Autoscale, Normalized, and Pixel.

Autoscale scales the icon to fit the block frame. When the block is resized, the icon is also resized. For example, this figure shows the icon drawn using these vectors:
X = [0 2 3 4 9]; Y = [4 6 3 5 8];

The lower-left corner of the block frame is (0,3) and the upper-right corner is (9,8). The range of the x-axis is 9 (from 0 to 9), while the range of the y-axis is 5 (from 3 to 8).
Normalized draws the icon within a block frame whose bottom-left corner is (0,0) and whose top-right corner is (1,1). Only X and Y values between 0 and 1 appear. When the block is resized, the icon is also resized. For example, this figure shows the icon drawn using these vectors:
X = [.0 .2 .3 .4 .9]; Y = [.4 .6 .3 .5 .8];

Pixel draws the icon with X and Y values expressed in pixels. The icon is not automatically resized when the block is resized. To force the icon to resize with the block, define the drawing commands in terms of the block size.
When the block is rotated or flipped, you can choose whether to rotate or flip the icon or to have it remain fixed in its original orientation. The default is not to rotate the icon. The icon rotation is consistent with block port rotation. This figure shows the results of choosing Fixed and Rotates icon rotation when the AND gate block is rotated.

The Icon & Ports > Port Rotation port option lets you specify a masked block's port rotation type. The choices are:
default
Ports are reordered after a clockwise rotation to maintain a left-to-right port numbering order for ports along the top and bottom of the block and a top-to-bottom port numbering order for ports along the left and right sides of the block.
physical
Ports rotate with the block without being reordered after a clockwise rotation.
The default rotation option is appropriate for control systems and other modeling applications where block diagrams typically have a top-down and left-right orientation. It simplifies editing of diagrams by minimizing the need to reconnect blocks after rotations to preserve the standard orientation.
Similarly, the physical rotation option is appropriate for electronic, mechanical, hydraulic, and other modeling applications where blocks represent physical components and lines represent physical connections. The physical rotation option more closely models the behavior of the devices represented (that is, the ports rotate with the block as they would on a physical device). In addition, the option avoids introducing line crossings as the result of rotations, making diagrams easier to read.
For example, the following figure shows two diagrams representing the same transistor circuit. In one, the masked blocks representing transistors use default rotation; in the other, physical rotation.

Both diagrams avoid line crossings that make diagrams harder to read. The next figure shows the diagrams after a single clockwise rotation.

Note that the rotation introduces a line crossing in the diagram that uses default rotation but not in the diagram that uses physical rotation. Note also that there is no way to edit the diagram with default rotation to remove the line crossing. See Changing a Block's Orientation for more information.
![]() | Mask Editor Overview | Parameters Pane | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |