Documentation

Add an Annotation Callback

Annotation Callback Functions

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 this association programmatically, see Annotations API. 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 Annotations API).

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 Annotations API).

Associate a Click Function with an Annotation

You can interactively associate a click function with an annotation.

  1. Add an annotation. Enter the annotation content but do not change any formatting. Changing formatting prevents you from adding a click function using the Simulink Editor.

  2. Open the Annotation Properties dialog box. Right-click the annotation and select Properties.

  3. Open the ClickFcn tab. In the text box under ClickFcn, enter the MATLAB code that defines the click function, and click OK.

    Tip   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, sometimes you cannot select the annotation by clicking. Instead, to select it, drag a selection box around it.

You cannot interactively edit the text in an annotation that is associated with a click function. To edit the annotation, right-click it and select Properties to use the Annotation Properties dialog box.

More About

Was this topic helpful?