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 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 Simulink.Annotation).

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 Simulink.Annotation).

Associate a Click Function with an Annotation

You can interactively associate a click function with an annotation.

  1. Add an annotation.

  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, 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.

Related Topics

Was this topic helpful?