Describe Models Using Annotations

Annotations are visual elements that you can use to add descriptive notes and callouts to your model. You can also add annotations that perform an action when you click them. Shortcuts on the Simulink® Editor palette help you to create annotations.

Text annotations can contain any combination of:

  • Text

  • Images

  • Equations using TeX commands

  • Hyperlinks that open a website or perform MATLAB® functions

Also, you can create an annotation that can hold only an image.

Add a Text Annotation

To create a text annotation, use one of these options:

  • Double-click the canvas where you want to create the annotation.

  • Click the annotation box on the palette and then click the canvas.

  • Drag the annotation box to the canvas.

After you add the text annotation, you can:

  • Apply formatting changes to text or insert an image or a table using the formatting toolbar.

  • Apply additional formatting, using the Paragraph menu on the context menu. For example, you can create bullet and numbered lists from this menu.

  • Add hyperlinks using the context menu. You can use hyperlinks to open a website or make an annotation interactive using MATLAB commands.

  • Apply properties using the Property Inspector. To view the Property Inspector, select View > Property Inspector.

Resize an Annotation

An annotation resizes as you enter content. You can also resize an annotation by dragging the corners. For example, you can hold Shift as you drag to resize proportionally.

After you resize an annotation, the annotation stays that size until you resize it again, regardless of the content size. To revert to the original height or width of the annotation, in the Property Inspector, under Appearance, clear the Fixed height or Fixed width check box.

Make an Annotation Interactive

To make the annotation interactive, use a hyperlink on any content of a text annotation.

  1. In the annotation, select the content that you want to make interactive. To make the entire annotation interactive, select all the content.

  2. Right-click and select Hyperlink from the context menu.

  3. In the Hyperlink dialog box, either:

    • Select URL Address as the target and enter the web address in the Code box.

    • Select MATLAB Code as the target and enter MATLAB functions in the Code box.

  4. Click OK.

For an alternative approach, see Add an Annotation Callback

Add an Image Annotation

You can add an annotation that contains only an image. Add an image annotation when you want to be able to resize or move the image independently of text. For example, you can put your company logo in an image and size and position it at a particular location in the model. You can also associate MATLAB functions with a click on the image.

  1. From the Simulink Editor palette, drag an Image box into the model.

  2. Add an image to the box. You can either:

    • Double-click the image box and browse to an image.

    • Paste an image from the clipboard. Right-click the image box and select Paste Image.

    Tip   If you resize the image, you can reset it to its original size. Right-click the image and select Format > Restore Size.

To associate an action with an image:

  1. Select the image.

  2. In the Property Inspector, under ClickFcn, add the MATLAB functions that you want to invoke with a click on the image.

Use TeX Commands in an Annotation

You can add TeX formatting commands to your annotation for mathematical and other symbols and Greek letters. For the supported TeX commands, see TeX for Simulink Model Annotations

  1. Add supported TeX commands to your annotation. For example, add this text:

    \sigma \kappa \mu
  2. With the annotation selected, or with the text cursor in the annotation, in the Property Inspector, under Appearance, select Enable TeX commands.

    When you click outside the annotation, the TeX commands appear as symbols in the annotation.

Add Lines to Connect Annotations to Blocks

You can add connector lines between an annotation and a block in the model. The connector is similar to a callout, identifying the block that an annotation applies to. If you move the annotation or block, the connector moves or resizes to keep the connection.

  1. Place the cursor over the annotation outline where you want the connector to start.

  2. When the cursor is a cross hair, drag the connector line to the block you want to connect to.

    Tip   To specify the color or width of the connector, right-click it and use the Format menu.

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 

Related Examples

Was this topic helpful?