Skip to Main Content Skip to Search
Product Documentation

Zooming a Chart Object with the API

How to Zoom a Chart Object

Use the Stateflow API method fitToView to zoom in on a graphical object in the chart. (See Using the API in the Stateflow API documentation for information about obtaining object handles.)

Objects You Can Zoom

You can zoom the following chart objects:

Example of Zooming 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 the state and highlights it.

  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.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS