Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Zoom a Chart Object Using 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 Getting a Handle on Stateflow 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 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.

Was this topic helpful?