Main Content

Stateflow.AtomicSubchart

Atomic subchart in chart, state, or box

    Description

    Use Stateflow.AtomicSubchart objects to create independent subcomponents in a Stateflow® chart. Atomic subcharts allow for:

    • Reuse of the same state or subchart across multiple charts and models

    • Faster simulation after making small changes to a chart with many states or levels of hierarchy

    • Ease of team development when multiple people are working on different parts of the same chart

    • Manual inspection of generated code for a specific state or subchart in a chart

    For more information, see Create Reusable Subcomponents by Using Atomic Subcharts.

    Creation

    Description

    example

    atomicSubchart = Stateflow.AtomicSubchart(parent) creates a Stateflow.AtomicSubchart object in a parent chart, state, or box.

    Input Arguments

    expand all

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

    Properties

    expand all

    Content

    Name of the atomic subchart, specified as a character vector.

    Full label for the atomic subchart, specified as a character vector.

    This property is read-only.

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

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

    This property is read-only.

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

    Comment text for the atomic subchart, 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 atomic subchart, 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 atomic subchart, specified as a four-element numeric vector of the form [left top width height].

    This property is read-only.

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

    Whether to display a preview of the atomic subchart contents, specified as a numeric or logical 1 (true) or 0 (false).

    Size of incoming transition arrows, specified as a scalar.

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

    State Decomposition

    This property is read-only.

    Decomposition of sibling states, specified as 'OR' or 'AND'. The atomic subchart inherits this property from the Decomposition property of its parent state or chart.

    Execution order for the atomic subchart in parallel (AND) decomposition, specified as an integer scalar. This property applies only when both of these conditions are satisfied:

    • The Type property of the atomic subchart is 'AND'.

    • The UserSpecifiedStateTransitionExecutionOrder property of the chart that contains the atomic subchart is true.

    Active State Output

    Whether to create an active state data output port for the atomic subchart, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Monitor State Activity Through Active State Data.

    This property is read-only.

    Active state data object for the atomic subchart, specified as a Stateflow.Data object. This property applies only when the HasOutputData property for the atomic subchart is true.

    Name of the active state data object for the atomic subchart, specified as a character vector. This property applies only when the HasOutputData property for the atomic subchart is true.

    Monitoring mode for the active state output data, specified as a character vector. For atomic subcharts, the only option is 'SelfActivity'.

    Signal Logging

    Whether to enable signal logging for the atomic subchart, specified as a numeric or logical 1 (true) or 0 (false). For more information, see Log Simulation Output for States and Data.

    Example: atomicSubchart.LoggingInfo.DataLogging = true;

    Whether to limit the amount of logged data, specified as a numeric or logical 1 (true) or 0 (false). When this property is true, signal logging skips samples by using the interval size specified by the LoggingInfo.Decimation property.

    Example: atomicSubchart.LoggingInfo.DeimateData = true;

    Decimation interval, specified as an integer scalar. The default value of 2 means that the chart logs every other sample.

    Example: atomicSubchart.LoggingInfo.Decimation = 5;

    Whether to limit the number of data points to log, specified as a numeric or logical 1 (true) or 0 (false). When this property is true, signal logging limits the number of data points by using the value specified by the LoggingInfo.MaxPoints property.

    Example: atomicSubchart.LoggingInfo.LimitDataPoints = true;

    Maximum number of data points to log, specified as an integer scalar. The default value of 5000 means the chart logs the last 5000 data points generated by the simulation.

    Example: atomicSubchart.LoggingInfo.MaxPoints = 100;

    Source of the signal name used to log the atomic subchart, specified as one of these values:

    • 'SignalName' — Use the name of the atomic subchart.

    • 'Custom' — Use the custom signal name specified by the LoggingInfo.LoggingName property.

    Example: atomicSubchart.LoggingInfo.NameMode = 'Custom';

    Custom signal name used for logging the atomic subchart, specified as a character vector. This property applies only when the LoggingInfo.NameMode property is 'Custom'.

    Example: atomicSubchart.LoggingInfo.LoggingName = 'Atomic Subchart';

    Debugging

    Whether to set the During State breakpoint for the atomic subchart, specified as a numeric or logical 1 (true) or 0 (false).

    Example: atomicSubchart.Debug.Breakpoints.OnDuring = true;

    Whether to set the On State Entry breakpoint for the atomic subchart, specified as a numeric or logical 1 (true) or 0 (false).

    Example: atomicSubchart.Debug.Breakpoints.OnEntry = true;

    Whether to set the On State Exit breakpoint for the atomic subchart, specified as a numeric or logical 1 (true) or 0 (false).

    Example: atomicSubchart.Debug.Breakpoints.OnExit = true;

    Whether to set the atomic subchart as a test point, specified as a numeric or logical 1 (true) or 0 (false).

    Hierarchy

    This property is read-only.

    Chart that contains the atomic subchart, specified as a Stateflow.Chart object.

    This property is read-only.

    Contents of the atomic subchart, specified as a Stateflow.Chart object. Use this object to add children, such as states and transitions, to the atomic subchart.

    This property is read-only.

    Subviewer for the atomic subchart, specified as a Stateflow.Chart, Stateflow.State, or Stateflow.Box object. The subviewer is the chart or subchart where you can graphically view the atomic subchart.

    This property is read-only.

    Machine that contains the atomic subchart, specified as a Stateflow.Machine object.

    This property is read-only.

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

    Identification

    Description for the atomic subchart, specified as a character vector.

    Document link for the atomic subchart, specified as a character vector.

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

    This property is read-only.

    Session-independent identifier, specified as an integer scalar. Use this property to distinguish the atomic subchart from other objects in the model.

    This property is read-only.

    Unique identifier, specified as an integer scalar. Unlike SSIdNumber, 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
    dialogOpen properties dialog box
    fitToViewZoom in on graphical object
    getReturn MATLAB structure containing property settings of object or array of objects
    highlightHighlight graphical object
    isCommentedDetermine if object is commented out
    setSet properties with specified values
    upReturn parent of object
    viewDisplay object in editing environment

    Examples

    collapse all

    Add an atomic subchart in the chart ch. Set its name to 'A'.

    atomicSubchart = Stateflow.AtomicSubchart(ch);
    atomicSubchart.Name = 'A';
    Introduced in R2010b