Main Content

Stateflow.op.OperatingPointData

Operating point information for chart data

Description

A Stateflow.op.OperatingPointData object contains a snapshot of a data object in a Stateflow® chart during simulation.

Creation

When you save the final operating point for a Simulink® model, as described in Save Operating Points, you create a Stateflow.op.BlockOperatingPoint object for each Stateflow chart in the model. This object contains a Stateflow.op.OperatingPointData object for each:

  • Chart output data

  • Chart, state, and function local data

  • Persistent variable in a MATLAB® function or truth table

Access a Stateflow.op.OperatingPointData object by using the property that matches the name of the data in the parent Stateflow.op.BlockOperatingPoint or Stateflow.op.OperatingPointContainer. For example, suppose that op is the Stateflow.op.BlockOperatingPoint object for a chart. To access the Stateflow.op.OperatingPointData object for a chart output called output, enter:

op.output

Similarly, to access the Stateflow.op.OperatingPointData object for a persistent variable called persistentVar in the MATLAB function function, enter:

op.function.persistentVar

Properties

expand all

This property is read-only.

Description of the saved operating point, specified as a character vector.

Data Types: char

This property is read-only.

Type of data, specified as a character vector. For more information, see Type.

Data Types: char

This property is read-only.

Size of the data, specified as a character vector. For more information, see Size.

Data Types: char

This property is read-only.

Range of acceptable values for the data, specified as a structure with fields Minimum and Maximum. For more information, see Limit range.

Data Types: struct

This property is read-only.

Initial value of data, specified as a value of the type determined by DataType. For more information, see Initial value.

Value of data, specified as a value of the type determined by DataType.

Object Functions

openDisplay object in editing environment

Examples

collapse all

  1. Open the model old_sf_car.

    openExample("old_sf_car")
  2. Set the model to save the final operating point. Open the Configuration Parameters dialog box and, in the Data Import/Export pane:

    1. Select Final states and enter a name for the operating point. For this example, use xSteadyState.

    2. Select Save final operating point.

    3. Click OK.

  3. Set the stop time for this simulation segment. In the Simulation tab, set Stop Time to 10.

  4. Run the simulation.

  5. Access the Stateflow.op.BlockOperatingPoint object that contains the operating point information for the shift_logic chart.

    blockpath = "old_sf_car/shift_logic";
    op = get(xSteadyState,blockpath)
    op = 
    
    Block:    "shift_logic"    (handle)    (active)
      Path:     old_sf_car/shift_logic
    
      Contains:
    
        + gear_state         "State (AND)"          (active)
        + selection_state    "State (AND)"          (active)
          gear               "Block output data"    double [1, 1]
          
  6. Highlight the states that are active in the chart at t = 10.

    highlightActiveStates(op)

    Stateflow chart showing active states.

  7. Access the Stateflow.op.OperatingPointData object that contains the operating point information for the chart output gear.

    op.gear
    ans = 
    
          Description: 'Block output data'
             DataType: 'double'
                 Size: '[1, 1]'
                Range: [1x1 struct]
         InitialValue: [1x0 double]
                Value: 4
     
  8. Change the value of gear to 1.

    op.gear.Value = 1;
  9. Inspect the modified operating point information for the chart output gear.

    op.gear
    ans = 
    
          Description: 'Block output data'
             DataType: 'double'
                 Size: '[1, 1]'
                Range: [1x1 struct]
         InitialValue: [1x0 double]
                Value: 1
    

Version History

Introduced in R2009b

expand all