Get operating point information for Stateflow chart, MATLAB System block, or S-function
MATLAB System blocks
S-functions with custom operating point implementation
To access the state for a built-in block, use the
property of the
Get Operating Point for Stateflow Chart
Open the model
mdl = "sldemo_fuelsys"; open_system(mdl)
Simulink.SimulationInput object to configure a simulation of the model.
simIn = Simulink.SimulationInput(mdl);
setModelParameter function to set the stop time for the simulation to 10 seconds and to configure the model to save the final states and operating point in the simulation.
simIn = setModelParameter(simIn,"StopTime","10"); simIn = setModelParameter(simIn,"SaveFinalState","on"); simIn = setModelParameter(simIn,"SaveOperatingPoint","on");
Simulate the model using the simulation configuration stored on the
out = sim(simIn);
Simulink.op.ModelOperatingPoint object that contains the model operating point.
modelOP = out.xFinal
modelOP = Simulink.op.ModelOperatingPoint Operating point of the model 'sldemo_fuelsys' at simulation time 10. Properties loggedStates description startTime (Read-only) snapshotTime (Read-only) Methods get set
Get the operating point for the Stateflow™ chart named
control_logic inside the subsystem named
chartPath = mdl + "/fuel_rate_control" + "/control_logic"; chartOP = get(modelOP,chartPath)
chartOP = Block: "control_logic" (handle) (active) Path: sldemo_fuelsys/fuel_rate_control/control_logic Contains: + Fail "State (AND)" (active) + Fueling_Mode "State (AND)" (active) + O2 "State (AND)" (active) + Pressure "State (AND)" (active) + Speed "State (AND)" (active) + Throttle "State (AND)" (active) es_o "Block output data" EngSensors [1, 1] fuel_mode "Block output data" sld_FuelModes [1, 1] O2_normal "State output data" boolean [1, 1]
modelOP — Model operating point
Model operating point, specified as a
blockPath — Path to model element whose operating point you want to access
string | character vector
Path to model element whose operating point you want to access, specified as a string or a character vector.
You cannot access or modify operating point information for Stateflow charts, MATLAB System blocks, or S-functions inside referenced models simulated using accelerator mode.
op — Element operating point
Stateflow.op.BlockOperatingPoint object | S-function operating point | MATLAB System block operating point
Element operating point, returned as a
Stateflow.op.BlockOperatingPoint (Stateflow) object, an S-function operating point, or a
MATLAB System block operating point.
For more information about working with operating points for Stateflow charts, see Save and Restore Operating Points for Stateflow Charts (Stateflow).
ssSetOperatingPointVisibilityfunction to specify whether operating point information for an S-function is accessible from the
Version HistoryIntroduced in R2019a
Simulink.SimState.ModelSimState is renamed to
Simulink.SimState.ModelSimState object, which was introduced in
R2009a, is renamed and replaced with the
object. You can still use simulation snapshots from a previous release that you captured and
ModelSimState objects. When you load the object into the workspace
or a model, the object is replaced with a
ModelOperatingPoint object that
contains the same data.
ModelOperatingPoint object has the same properties as the
ModelSimState object. The
getBlockSimState functions continue to work but are not
recommended. Instead, use the
functions for the