| Stateflow User's Guide | ![]() |
Watching Stateflow Data in MATLAB
When simulation reaches a breakpoint, you can see the values for Stateflow data in the MATLAB Workspace Browser and in the MATLAB Command Window. In the following example, a default transition calls an Embedded MATLAB function with a breakpoint set at the last executable line of the function:
When simulation reaches the breakpoint, the MATLAB Workspace Browser is updated with the values of Stateflow data in the scope of the breaking object (state, function, and so on), as shown.
All data displayed in the Workspace dialog at the break point cannot be modified. This means that the following tools for the Workspace dialog are disabled at this time:
| Tool Icon |
Tool Name |
| Add New Variable |
|
| Load Data File |
|
| Delete |
Once the breakpoint is reached you can also display Stateflow data in the MATLAB Command Window for the preceding example as follows:
stdev at the prompt and press Enter to display its value, as shown.
whos.
The Command Line Debugger provides the following commands during simulation
| Command |
Description |
dbstep |
Advance to next program step after a breakpoint is encountered. |
dbcont |
Continue execution to next breakpoint. |
dbquit(ctrl-c) |
Stop simulation of the model. Press Enter after this command to return to the MATLAB prompt. |
| help |
Displays help for command-line debugging. |
| print x |
Display the value of the variable x. This is equivalent to typing x at the Command Line Debugger prompt. If x is a vector or matrix, you can also index into x. For example, x(1,2). |
| save |
Saves all variables to the specified file. Follows the syntax of the MATLAB save command. To retrieve variables to the MATLAB base workspace, use load command after simulation has been ended. |
whos |
Display the size and class (type) of all variables in the scope of the halted Embedded MATLAB Fcn block. |
You can issue any other MATLAB command at the debug>> prompt, but the results are executed in the Stateflow workspace. To issue a command in the MATLAB base workspace at the debug>> prompt, use the evalin command with the first argument 'base' followed by the second argument command string, for example, evalin('base','whos').
| Watching Data in the Stateflow Debugger | Monitoring Stateflow Test Points | ![]() |
© 1994-2005 The MathWorks, Inc.