Stateflow.Annotation
Annotation in chart, state, box, or function
Description
Use Stateflow.Annotation
objects to include descriptive comments
in your chart. Annotations can contain any combination of:
Text
Images
Equations using TeX commands
Hyperlinks that open a website or perform MATLAB® functions
For more information, see Add Descriptive Comments in a Chart.
Creation
Description
Input Arguments
parent
— Parent for new annotation
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
Parent for the new annotation, specified as a Stateflow® API object of one of these types:
Properties
Stateflow API objects have properties that correspond to the values you set in the Stateflow
Editor. To access or modify a property, use dot notation. To access or modify multiple
properties for multiple API objects, use the get
and
set
functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.
Content
Text
— Text for annotation
"?"
(default) | string scalar | character vector
Text for the annotation, specified as a string scalar or character vector.
Alignment
— Alignment of text
"LEFT"
(default) | "CENTER"
| "RIGHT"
Alignment of the annotation text, specified as "LEFT"
,
"CENTER"
, or "RIGHT"
.
Interpretation
— Format of text
"OFF"
(default) | "RICH"
| "TEX"
Format of the annotation text, specified as "OFF"
,
"RICH"
, or "TEX"
.
PlainText
— Text without formatting
character vector
This property is read-only.
Annotation text without formatting, specified as a character vector.
IsImage
— Whether annotation contains image
false
or 0 (default) | true
or 1
This property is read-only.
Whether the annotation contains an image, specified as a numeric or logical 1
(true
) or 0 (false
).
Graphical Appearance
Position
— Position and size of annotation box
[0 0 8 16]
(default) | [left top width height]
Position and size of annotation box, specified as a four-element numeric vector of
the form [left top width height]
.
InternalMargins
— Space between text and border of annotation box
[0 0 0 0]
(default) | [left top right bottom]
Space between the text and the border of the annotation box, specified as a
four-element numeric vector of the form [left top right
bottom]
.
DropShadow
— Whether to display a drop shadow around annotation box
false
or 0 (default) | true
or 1
Whether to display a drop shadow around the annotation box, specified as a numeric
or logical 1 (true
) or 0 (false
).
FixedHeight
— Whether to fix height of annotation box
false
or 0 (default) | true
or 1
Whether to fix the height of the annotation box, specified as a numeric or logical
1 (true
) or 0 (false
).
true
— Fixes the height of the annotation box and hides content that is longer than the box.false
— Resizes the annotation box vertically as you add content.
FixedWidth
— Whether to fix width of annotation box
false
or 0 (default) | true
or 1
Whether to fix the width of the annotation box, specified as a numeric or logical
1 (true
) or 0 (false
).
true
— Fixes the width of the annotation box and wraps text that is longer than the box.false
— Resizes the annotation box horizontally as you add content.
BackgroundColor
— Background color
[1 1 1]
(default) | [red green blue]
Background color for the annotation, specified as a three-element numeric vector
of the form [red green blue]
that specifies the red, green, and
blue values. Each element must be in the range between 0 and 1. This property applies
only when the AutoBackgroundColor
property is
false
.
ForegroundColor
— Foreground color
[0 0 0]
(default) | [red green blue]
Foreground color for the annotation, specified as a three-element numeric vector
of the form [red green blue]
that specifies the red, green, and
blue values. Each element must be in the range between 0 and 1. This property applies
only when the AutoForegroundColor
property is
false
.
AutoBackgroundColor
— Whether to use default background color
true
or 1 (default) | false
or 0
Whether to use the default background color, specified as a numeric or logical 1
(true
) or 0 (false
).
true
— Use the default color specified by theChartColor
property of the chart that contains the annotation.false
— Use the color specified by theBackgroundColor
property of the annotation.
AutoForegroundColor
— Whether to use default foreground color
true
or 1 (default) | false
or 0
Whether to use the default foreground color, specified as a numeric or logical 1
(true
) or 0 (false
).
true
— Use the default color specified by theStateLabelColor
property of the chart that contains the annotation.false
— Use the color specified by theForegroundColor
property of the annotation.
Font
— Font for annotation text
Stateflow.NoteFont
object
Font for the annotation text, specified as a Stateflow.NoteFont
object with these properties:
Name
— Font name, specified as a character vector. This property is read-only. TheStateFont.Name
property of the chart that contains the annotation sets the value of this property.Angle
— Font angle, specified as"NORMAL"
or"ITALIC"
.Weight
— Font weight, specified as"NORMAL"
or"BOLD"
.Size
— Font size, specified as a scalar.
Example: annotation.Font.Angle = "ITALIC";
Example: annotation.Font.Weight = "BOLD";
Example: annotation.Font.Size = 8;
Callbacks
ClickFcn
— Callback on click
""
(default) | string scalar | character vector
Callback on click, specified as a string scalar or character vector. This callback contains MATLAB code to execute when to execute when you click the annotation.
LoadFcn
— Callback at model load
""
(default) | string scalar | character vector
Callback at model load, specified as a string scalar or character vector. This callback contains MATLAB code to execute when you load the model that contains the annotation.
DeleteFcn
— Callback at delete
""
(default) | string scalar | character vector
Callback at delete, specified as a string scalar or character vector. This callback contains MATLAB code to execute before you delete the annotation.
UseDisplayTextAsClickCallback
— Whether to use annotation text as callback
false
or 0 (default) | true
or 1
Whether to use the annotation text as a callback, specified as a numeric or
logical 1 (true
) or 0 (false
). When this
property is enabled, the contents of the Text
property is used as
the callback when you click the annotation.
Hierarchy
Chart
— Chart that contains annotation
Stateflow.Chart
object
This property is read-only.
Chart that contains the annotation, specified as a
Stateflow.Chart
object.
Subviewer
— Subviewer for annotation
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
This property is read-only.
Subviewer for the annotation, specified as a Stateflow.Chart
,
Stateflow.State
, Stateflow.Box
, or
Stateflow.Function
object. The subviewer is the chart or subchart
where you can graphically view the annotation.
Machine
— Machine that contains annotation
Stateflow.Machine
object
This property is read-only.
Machine that contains the annotation, specified as a Stateflow.Machine
object.
Path
— Location of parent in model hierarchy
character vector
This property is read-only.
Location of the parent of the annotation in the model hierarchy, specified as a character vector.
Identification
Description
— Description
""
(default) | string scalar | character vector
Description for the annotation, specified as a string scalar or character vector.
Document
— Document link
""
(default) | string scalar | character vector
Document link for the annotation, specified as a string scalar or character vector.
Tag
— User-defined tag
[]
(default) | any data type | ...
User-defined tag for the annotation, specified as data of any type.
Id
— Unique identifier
scalar
This property is read-only.
Unique identifier, specified as an integer scalar. Use this property to distinguish the annotation from other objects in the model. The value of this property is reassigned every time you start a new MATLAB session and may be recycled after an object is deleted.
Object Functions
Examples
Add Text Annotation to Chart
Add an annotation in the chart ch
. Set its content to
"This is an annotation."
annotation = Stateflow.Annotation(ch);
annotation.Text = "This is an annotation";
Add Image Annotation to Chart
Add an annotation in the chart ch
. Use the file
myImageFile.png
, which is located in the folder
myfolder/annotation_images
, as the image for the
annotation.
annotation = Stateflow.Annotation(ch); setImage(annotation, ... fullfile("myfolder","annotation_images","myImageFile.png"));
Version History
Introduced in R2017b
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)