Simulink.Annotation
Create and specify properties of text, image, and area annotations
Description
Annotations are visual elements that you can use to add descriptive notes and
callouts to your model. You can programmatically access and modify them as
Simulink.Annotation
objects.
To get an existing Simulink.Annotation
object, select the annotation.
Then, use the getCurrentAnnotation
function.
Creation
You can create a Simulink.Annotation
object in multiple ways.
To programmatically create an
Annotation
object, use theSimulink.Annotation
function described on this page.To interactively create an
Annotation
object, see Annotate Models.
Description
creates an annotation with properties specified using name-value pairs. For example,
a
= Simulink.Annotation(path
,Name,Value
)Simulink.Annotation('model/annotation','BackgroundColor','yellow')
creates an annotation with a yellow background. You can specify multiple
name-value pairs. Enclose each property name in quotes.
Input Arguments
Properties
Object Functions
Examples
Tips
To programmatically modify an existing annotation, use the
find_system
function to get the annotation handle, then use theget_param
function to get the object. For example:h = find_system(gcs,'FindAll','on','Type','annotation'); a1 = get_param(h(1),'Object');
If an annotation invoked a currently executing callback function, use the
getCallbackAnnotation
to determine which annotation invoked it. The function returns the correspondingAnnotation
object. This function is also useful if you write a callback function in a separate MATLAB file that contains multiple callback calls.
Alternative Functionality
You also can create annotations using the add_block
function. For example:
add_block('built-in/Note','model/This is a note.','BackgroundColor','yellow')
creates a note annotation with a yellow background.add_block('built-in/Area','model/This is an Area.','Position',[120,100,230,200])
creates an area annotation at the specified position.
To interactively create an annotation and edit its properties, see Annotate Models.
Version History
Introduced before R2006a