View Stateflow Graphical Objects

Use the Stateflow® API method fitToView to zoom in on a graphical object in the chart. (See Get Handles to API Objects for information about obtaining object handles.)

Objects You Can Zoom

You can zoom the following chart objects:

  • Charts

  • Subcharts

  • States

  • Transitions

  • Graphical functions

  • Truth table functions

  • MATLAB® functions

  • Simulink® functions

  • Connective junctions

  • History junctions

  • Boxes

  • Notes

Zoom States in a Chart

Follow these steps to zoom in on different states:

  1. At the MATLAB command prompt, type:

    old_sf_car;

    The chart shift_logic appears.

  2. To define an object handle for the chart shift_logic, type:

    myChart = find(sfroot,'-isa','Stateflow.Chart', ...
        'Name','shift_logic');
  3. To define an object handle for the state upshifting, type:

    myState = find(sfroot,'-isa','Stateflow.State', ...
        'Name','upshifting');
  4. To zoom in on the state upshifting, type:

    myState.fitToView;

    The chart zooms in on the state and highlights it.

  5. To define an object handle for the state downshifting, type:

    myState = find(sfroot,'-isa','Stateflow.State', ...
        'Name','downshifting');
  6. To zoom in on the state downshifting, type:

    myState.fitToView;

    The chart zooms in on and highlights the state.

  7. To zoom out to the chart-level view, type:

    myChart.fitToView;

    The chart shift_logic reappears.

  8. You can also zoom in on a state using the sfgco function. Follow these steps:

    1. Click any state in the chart.

    2. At the MATLAB command prompt, type:

      myState = sfgco;

      This command assigns the selected state to the object handle myState.

    3. To zoom in on the selected state, type:

      myState.fitToView;

      The chart zooms in on the state and highlights it.

Related Topics