Display state values during simulation debugging session
states displays in the MATLAB® Command Window the current state values for the model running in the current
simulation debugging session. The information displayed for each state includes the state
index, state value, and block name.
You can use this function in a simulation debugging session started:
This function is available only for simulation debugging sessions started programmatically and for interactive simulation debugging sessions while paused within a time step.
Display State Values During Simulation Debugging Session
states function to display the current
values for states in the model
vdp in a simulation debugging
Open the model
Start a simulation debugging session for the model
vdp using the
sldebug function. The MATLAB Command Prompt (
>>) becomes the Simulink debugger prompt (
(sldebug @0): >> ).
(sldebug @0): >>
states function to view a list of states in the model
and their current values.
Continuous States for 'vdp': Idx Value (system:block:element Name 'BlockName') 0. 0 (0:0:0 CSTATE 'vdp/x1') 1. 0 (0:2:0 CSTATE 'vdp/x2')
When you have finished debugging, use the
stop function to end
the simulation debugging session.
To start a simulation debugging session interactively, add one or more breakpoints to your model and in the Breakpoints List, check that Pause within time step is selected. When the simulation pauses on a breakpoint, some of the programmatic debugging commands, such as the
stop command, are available for use in the MATLAB Command Window.
Introduced before R2006a