You can make an annotation interactive by adding a callback. For example, you can use an annotation click-callback function to open related models from an annotation.
You can associate the following callback functions with annotations.
A click function is a MATLAB® function that Simulink® invokes when you click an annotation. You can associate a click function with any model annotation.
You can use click functions to add custom command buttons to a model. For example, a click function can display the values of workspace variables referenced by the model or to open related models.
Simulink uses the color blue for an annotations associated with a click function.
Simulink invokes this 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 Annotations API).
This function is invoked before deleting the associated annotation.
To associate a delete function with an annotation, set the
of the annotation to the desired function (see Annotations API).
To associate a click function with an annotation, use one of these approaches:
Specify the annotation itself as the click function.
Specify a separately defined click function.
To specify the annotation itself as the click function:
Click in the annotation and select Diagram > Properties.
In the Annotation Properties dialog box ClickFcn area, select Use display text as click callback.
To specify a separately-defined click function:
Right-click the annotation border and select Properties.
Click the ClickFcn tab.
In text box below Use display text as click callback, enter the MATLAB code that defines the click function.
Note: You can also use MATLAB code to associate a click function with an annotation. See Annotations API for more information.
If you associate an annotation with a click function, then you cannot select the annotation by clicking it. Instead, use a boundary box to select the annotation.
Similarly, you cannot edit the annotation text by clicking on the text. To edit the annotation:
Use a boundary box to select the annotation
Right-click the selected annotation.
In the context menu, select Properties.
In the Properties dialog box, in the Text field, edit the text.