Stateflow.SimulationData.Data
Data values during simulation
Description
Use Stateflow.SimulationData.Data
to log the values of local and
output data during simulation.
Creation
In the Symbols pane, select a local or output data object.
In the Property Inspector, under Logging, select the Log signal data check box.
Properties
Name
— Logging name of data object
character array
Logging name of the data object, specified as a character array. By default, the
logging name for a data object is the name of the data object. To assign another name to
the data object, in the Property Inspector, under Logging
Name, select Custom
and enter a custom logging
name.
Data Types: char
BlockPath
— Block path for source block
Simulink.SimulationData.BlockPath
Block path for the source block, specified as a Simulink.SimulationData.BlockPath
(Simulink) object.
Data Types: Simulink.SimulationData.BlockPath
Values
— Logged data and time
timeseries
Logged data and time, specified as a timeseries
object.
Data Types: timeseries
Object Functions
plot (Simulink) | Plot simulation output data in the Simulation Data Inspector |
Examples
Access Logged Data
Open the
sf_semantics_hotel_checkin
model.openExample("stateflow/SemanticsHotelCheckinExample")
Open the
Hotel
chart.Open the Symbols pane. In the Simulation tab, in Prepare, click Symbols Pane.
Open the Property Inspector. In the Simulation tab, in Prepare, click Property Inspector.
Configure the
service
local data for logging.In the Symbols pane, select
service
.In the Property Inspector, on the Logging tab, select the Log signal data check box.
Return to the Simulink® model.
Simulate the model. After starting the simulation, check into the hotel by toggling the first switch and order room service multiple times by toggling the second switch. During simulation, Stateflow® saves logged data in a
Simulink.SimulationData.Dataset
(Simulink) signal logging object. The default name of the signal logging object islogsout
. For more information, see Export Signal Data Using Signal Logging (Simulink).Stop the simulation.
To access the signal logging object, at the MATLAB® command prompt, enter:
logsout
logsout = Simulink.SimulationData.Dataset 'logsout' with 1 element Name BlockPath ___________ ________________________________ 1 [1x1 Data ] service sf_semantics_hotel_checkin/Hotel
To access logged element, use the
get
(Simulink) method.serviceLog = logsout.get("service")
serviceLog = Stateflow.SimulationData.Data Package: Stateflow.SimulationData Properties: Name: 'service' BlockPath: [1×1 Simulink.SimulationData.BlockPath] Values: [1×1 timeseries]
To access the logged data and time of each logged element, use the
Values.Data
andValues.Time
properties. For example, arrange logged data in tabular form by using thetable
function.T = table(serviceLog.Values.Time,serviceLog.Values.Data); T.Properties.VariableNames = ["Time" "Data"]
T = 6×2 table Time Data __________ ____ 1.7076e+06 0 1.8607e+06 1 1.9653e+06 2 1.9653e+06 3 1.9653e+06 4 2.2912e+06 5
Version History
See Also
Stateflow.SimulationData.State
| Simulink.SimulationData.BlockPath
(Simulink) | timeseries
| plot
(Simulink)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)