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:
Equations using LaTeX and MathML commands
Hyperlinks that open a website or perform MATLAB® functions
Also, you can create an image-only annotation.
To get started, in the Modeling tab, under Design, click Notes. If the model has notes associated with it, they appear in a pane to the right of the model. As you navigate the hierarchy, notes for each system appear. If the model does not have notes, you can add them.
Notes are stored in a file with the extension
.mldatx. If you want
your model to have notes, first create the notes file. See Add and Edit Notes. After you create the
file, the notes you add are saved automatically.
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 that match your model. Notes files contain model name and version information to ensure the notes file and model match.
.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.
Use the Notes pane to edit and read notes. Use the Read/Edit Notes toggle to switch between modes. When you click Edit Notes, the editing features are enabled. When you click Read Notes, the editing features are not available. Instead, the content displays in read-only format. As you navigate the model, the Notes pane updates with the content for the current system.
In the model, on the Modeling tab, under Design, click Notes. The notes interface appears to the right of the model and includes instructions to get started.
Click the Create a notes file button.
Enter a name for the notes file, or use the default name, and click Save.
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 show as notes for the current system.
Navigate to a different system in the model and enter text, use a URL, or select Show Parent Notes.
Select No Notes.
When you have finished adding and editing, click the Read Notes toggle button to put the notes in reading mode.
To edit notes from reading mode, navigate to the system whose content you want to edit and click the Edit Notes toggle button .
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.
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, in the Modeling tab, under Design, click Property Inspector.
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.
To make the annotation interactive, use a hyperlink on any content of a text annotation.
In the annotation, select the content that you want to make interactive. To make the entire annotation interactive, select all the content.
Right-click and select Hyperlink from the context menu.
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.
For an alternative approach, see Annotation Callback Functions.
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.
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.
Drag an image from your local file system to the Simulink Editor canvas.
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:
Select the image.
In the Property Inspector, under ClickFcn, add the MATLAB functions that you want to invoke with a click on the image.
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.
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.
You can add TeX formatting commands to your 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 supported in Simulink annotations.
|Supported TeX Characters|
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.
To specify the color or width of an annotation connector, right-click it and use the Format menu.
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 back 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), from the annotation context menu, select Convert to Annotation.
To hide all markup annotations, in the Format tab, click Show Markup.
To display hidden markup annotations, in the Format tab, click Show Markup.
In a model reference hierarchy, Show Markup and Hide Markup apply only to the current model reference level.
You can associate these callback functions with annotations.
Click Function. You can make an annotation interactive using a link. Alternatively, you can make an annotation interactive by adding a click function callback. A click function is a MATLAB function that Simulink invokes when you click an annotation.
You can add a click function callback programmatically or interactively. To create a
click function programmatically, see
Simulink.Annotation. To create one
interactively, see Associate a Click Function with an Annotation.
The text for annotations associated with a click function appears in blue.
Load Function. Simulink invokes a load function when you load the model that contains the
associated annotation. To associate a load function with an annotation, set the
LoadFcn property of the annotation to the desired function (see
Delete Function. A delete function is invoked before you delete an annotation. To associate a delete
function with an annotation, set the
DeleteFcn property of the
annotation to the desired function (see
Associate a Click Function with an Annotation. You can interactively associate a click function with an annotation.
Add an annotation.
Open the Annotation Properties dialog box. Right-click the annotation and select Properties.
Open the ClickFcn tab. In the text box under ClickFcn, enter the MATLAB code that defines the click function, and click OK.
Alternatively, you can use the annotation text as the click function. Then, in the Annotation Properties dialog box, select the Use annotation text as click callback check box.
Select and Edit Click-Function Annotations. 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.