Stateflow    

Access the Chart Object

In the previous section, Access the Machine Object, you accessed the machine object containing your new chart to return a handle to the Machine object for your new model, m. Perform the following steps to access the new Stateflow chart.

  1. Access the new Chart object and assign it to the workspace variable chart as follows:
  1. In the preceding command, the findDeep method of the Machine object m returns an array of all charts belonging to that machine. Because you created only one chart, the result of this command is the chart you created. If you created several charts, the findDeep method returns an array of charts that you could access through indexing (chart(1), chart(2), and so on).

    You can also use standard function notation instead of dot notation for the preceding command. In this case, the first argument is the machine object handle.

  1. Open the Stateflow chart with the following API command:
  1. The preceding command calls the view method of the Chart object whose handle is chart. This displays the specified chart in the Stateflow diagram editor. You should now have an empty Stateflow chart in front of you. Other Stateflow API objects have view methods as well.


  Access the Machine Object Create New Objects in the Chart