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.

Text annotations can contain any combination of:

  • Text

  • Images

  • Equations using LaTeX and MathML commands

  • Hyperlinks that open a website or perform MATLAB® functions

Also, you can create an image-only annotation.

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 and select Create Annotation from the menu.

  • Click the annotation box on the Simulink® Editor 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, table, or equation 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

When you want to resize or move an image independently from text, create an image annotation. For example, you can size and position your company logo at a particular location in the model. You can also invoke MATLAB functions with a click on the image. To add an annotation that contains an image, drag the image from your file system to the canvas.

Tip

To include an image such as a logo in every new model, add the image to your default template. See Create a Template from a Model.

Alternatively, you can drag an Image box from the palette onto the canvas. Then 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 an 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.

Add Equations in an Annotation

You can add equations to your annotation by clicking the Insert Equation button in the annotation formatting toolbar.

In the Edit Equation dialog box, enter LaTeX or MathML code to generate equations. For LaTeX commands, see Insert LaTeX Equation (MATLAB).

To edit equation code, double-click the equation in the annotation. Similar to text in annotations, you can format equations in annotations by using the formatting toolbar. You can change the font color, text highlight color, font size, and location of equations in annotations.

Associate Annotations with Blocks and Areas

You can add a line between an annotation and a block or area in a model. These annotation connectors attach dynamically at both ends, so that they move and resize as necessary to maintain the connection.

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

  2. When the cursor is a crosshair, drag the line to the block or area where you want the line to end.

Tip

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

Related Topics

See Also