Main Content

Stateflow.Box

Box in chart, state, box, or function

    Description

    Use Stateflow.Box objects to organize objects such as functions and states in your chart. You can also use a box to encapsulate states and functions in a separate namespace. For more information, see Group Chart Objects by Using Boxes.

    Creation

    Description

    example

    box = Stateflow.Box(parent) creates a Stateflow.Box object in a parent chart, state, box, or graphical function.

    Input Arguments

    expand all

    Parent for the new box, specified as a Stateflow® API object of one of these types:

    Properties

    expand all

    Content

    Name of the box, specified as a character vector.

    Full label for the box, specified as a character vector.

    Whether to comment out the box, specified as a numeric or logical 1 (true) or 0 (false). Setting this property to true is equivalent to right-clicking the box and selecting Comment Out. For more information, see Commenting Stateflow Objects in a Chart.

    This property is read-only.

    Whether the box is implicitly commented out, specified as a numeric or logical 1 (true) or 0 (false). The box is implicitly commented out when you comment out a superstate in its hierarchy.

    Comment text for the box, specified as a character vector. This property applies only when the IsExplicitlyCommented property is true. In the Stateflow Editor, when you point to the comment badge on the box, the text appears as a tooltip. When you set the IsExplicitlyCommented property to false, the value of CommentText reverts to ''.

    Graphical Appearance

    Position and size of the box, specified as a four-element numeric vector of the form [left top width height].

    This property is read-only.

    Whether the box graphically intersects a box, state, or function, specified as a numeric or logical 1 (true) or 0 (false).

    Whether the box is a grouped box, specified as a numeric or logical 1 (true) or 0 (false). When you copy and paste a grouped box, you copy not only the box but all of its contents. For more information, see Copy and Paste by Grouping.

    Whether the box is a subchart, specified as a numeric or logical 1 (true) or 0 (false).

    Whether to display a preview of the box contents, specified as a numeric or logical 1 (true) or 0 (false). This property applies only when the IsSubchart property is true.

    Font size for the box label, specified as a scalar. The StateFont.Size property of the chart that contains the box sets the initial value of this property.

    Hierarchy

    This property is read-only.

    Chart that contains the box, specified as a Stateflow.Chart object.

    This property is read-only.

    Subviewer for the box, 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 box.

    This property is read-only.

    Machine that contains the box, specified as a Stateflow.Machine object.

    This property is read-only.

    Location of the parent of the box in the model hierarchy, specified as a character vector.

    Identification

    Description for the box, specified as a character vector.

    Document link for the box, specified as a character vector.

    User-defined tag for the box, specified as data of any type.

    This property is read-only.

    Unique identifier, specified as an integer scalar. Use this property to distinguish the box 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

    classhandleProvide class handle for object
    defaultTransitionsReturn default transitions in object at top level of containment
    dialogOpen properties dialog box
    findSpecified objects in hierarchy
    fitToViewZoom in on graphical object
    getReturn MATLAB structure containing property settings of object or array of objects
    highlightHighlight graphical object
    innerTransitionsReturn inner transitions that originate with chart or state and terminate on contained object
    isCommentedDetermine if object is commented out
    outerTransitionsReturn array of outer transitions for object
    setSet properties with specified values
    sinkedTransitionsReturn transitions that have object as destination
    sourcedTransitionsReturn transitions that have object as source
    upReturn parent of object
    viewDisplay object in editing environment

    Examples

    collapse all

    Add a box in the chart ch. Set its name to 'A'.

    box = Stateflow.Box(ch);
    box.Name = 'A';
    Introduced before R2006a