Describe Models Using Notes and Annotations
You can describe your model with notes and annotations to help others to understand it. You can add notes to any system in the model hierarchy by entering text, showing website content, or inheriting note content from the parent system. For each system, you can also choose not to show any notes.
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 annotation.
Create, Edit, and Read Notes
In the Simulink® Toolstrip, on the Modeling tab, click Notes. The Notes pane opens. As you navigate the hierarchy, notes for each system appear. If the model does not have notes, the pane includes instructions to get started.
To add notes:
In the Notes pane, click Create a notes file.
Notes are stored in a file with the extension
.mldatx
. If you want your model to have notes, first create the notes file. After you create the file, the notes you add are saved automatically.The
.mldatx
file is saved separate from the model. If you move your model to a different folder, the.mldatx
file does not also move, but the association remains if the file is on the MATLAB path.Enter a name for the notes file, or use the default name, and click Save.
You can have multiple notes files associated with the same model, for example, for users with different roles. The person using the model can then select among notes files. Notes files contain the model name and version information to ensure the notes file and model match.
The Notes pane is in editing mode. You can add notes in these ways:
Enter text in the text editor.
From the menu, select Use URL for Notes and enter a URL whose content you want to use as notes for the current system.
Navigate to a different system in the model and use the menu to select whether to enter text, use a URL, or show parent notes.
Select No Notes.
When you have finished adding and editing, click the Read Notes button
to toggle the notes to reading mode.
Use the Read Notes or Edit Notes button
to switch between the reading and editing modes. When you
click Edit Notes, the editing features are enabled. When you click
Read Notes, the editing features are not available, and the notes
display in read-only format. As you navigate the model, the Notes pane
updates with the content for the current system.
Create Text Annotations
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
on the Simulink Editor palette to the canvas.
Drag text from another application to the canvas.
Paste text from the clipboard. Right-click the canvas and select Paste.
When you edit the text annotation, you can:
Apply formatting changes to text or insert an image, table, or equation using the formatting toolbar.
Apply additional formatting by right-clicking the annotation and selecting Paragraph from the context menu. For example, you can create bulleted 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 by using MATLAB commands.
Apply properties using the Property Inspector. To view the Property Inspector, in the Modeling tab, under Design, click Property Inspector.
Add Equations to Annotations
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 supported LaTeX commands, see Insert LaTeX Equation.
To edit equation code, double-click the equation in the annotation. 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.
You can also type TeX formatting commands directly into the text of an annotation for mathematical and other symbols and Greek letters.
Add supported TeX commands to your annotation. For example, add this text:
\sigma \kappa \mu
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.
The table shows the TeX characters that you can type directly into the text of a Simulink annotation.
Supported TeX Characters | ||
---|---|---|
|
|
|
Create Image Annotations
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. To add an annotation that contains an image, drag an image from your local file system to the Simulink Editor canvas.
Tip
To include an image such as a logo in every new model, add the image to your default template. See Create Template from 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.
Resize Annotations
An annotation resizes as you enter content. You can also resize an annotation by dragging the corners. To resize proportionally, press Shift as you drag.
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.
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.
Place the cursor over the annotation outline where you want the line to start.
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 the connector and use the Format menu.
Hide Annotations
By default, all annotations appear in the model. To hide an annotation, first configure it for hiding by converting it to markup. Then, in the Format tab, click Show Markup.
You can configure an annotation so that you can hide or display it.
Right-click the annotation.
From the context menu, select Convert to Markup.
A markup annotation has a light-blue background, regardless of the background color you set. If you change a markup annotation to a regular annotation, the annotation returns to the background color you set.
To change a markup annotation to a regular annotation (one that you cannot hide), right-click the annotation and select Convert to Annotation.
To hide all markup annotations, in the Format tab, disable Show Markup.
To display hidden markup annotations, in the Format tab, enable Show Markup.
Note
In a model reference hierarchy, Show Markup and Hide Markup apply only to the current model reference level.
Make Annotations Interactive
To make an annotation interactive, use a hyperlink on any content in a text annotation.
In the annotation, select the content that you want to make interactive.
Right-click and select Hyperlink from the context menu.
In the Hyperlink dialog box, either:
Select URL Address and enter the web address in the Code box.
Select MATLAB Code and enter MATLAB functions in the Code box.
Click OK.
Alternatively, you can associate these callback functions with text or image annotations.
Annotation Callback Function | Description |
---|---|
Click Function | A click function is a MATLAB function that Simulink invokes when you click an annotation. To associate a click function with an annotation:
The text for annotations associated with a click function appears in blue. If you associate an annotation with a click function, clicking invokes the function rather than selecting the annotation. To select it instead, drag a selection box around it. To edit it, right-click it and select Edit Text or Properties. |
Load Function | A load function is a MATLAB function that Simulink invokes when you load the model that contains the associated annotation. To associate a load function with an annotation,
programmatically set the |
Delete Function | A delete function is a MATLAB function that Simulink invokes before you delete an annotation. To associate
a delete function with an annotation, programmatically set the
|