Save Run-Time Data from Simulation
You can save signal values to the MATLAB workspace or to an MLDATX file, MAT file, or Excel® during simulation for later retrieval and postprocessing. Saving simulation data is also known as logging or exporting simulation data.
Saving simulation data in Dataset
format simplifies
postprocessing by providing a common format for the results of a variety of
logging techniques. Using Dataset
format stores the data
as MATLAB
timeseries
objects, which you can process with
MATLAB.
Signal logging and data stores use
Dataset
format.Output and state logging use
Dataset
as the default format.The default save format for the To File and To Workspace blocks is
Timeseries
.
Simulink® provides tools to convert logged data to
Dataset
format.
To determine which approach to use for logging signal data, see Export Simulation Data.
Blocks
Outport | Create output port for subsystem or external output |
Record, XY Graph | Log data to the workspace, to a file, or both |
To File | Write data to file |
To Workspace | Log data to workspace from Simulink model |
Tools
Instrumentation Properties | View and edit logging and visualization properties for logged signal |
Signal Properties | View and edit signal properties |
Simulation Data Inspector | Inspect and compare data and simulation results to validate and iterate model designs |
Functions
Objects
Model Settings
Topics
Simulation Data
- Export Simulation Data
Export (log) simulation data as a baseline for analyzing and debugging a model. - Data Format for Logged Simulation Data
You can use many formats for logged data, including Dataset, MATLAB timeseries, arrays, and structures. Supported data formats vary between different logging techniques. However, Dataset format is available for all logging techniques. - Dataset Conversion for Logged Data
To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor. - Work with Big Data for Simulations
Log, load, and analyze big data for simulations. - Limit the Size of Logged Data
Choose among several strategies to limit the size of logged data. - Specify Signal Values to Log
Specify which signal values to log during simulation. - Log Data to Persistent Storage
Store logged simulation data to persistent storage in a MAT-file. - Load Big Data for Simulations
Load big data as simulation input. - Analyze Big Data from a Simulation
Access simulation data logged to persistent storage for analysis in MATLAB. - Log Signal Data That Uses Units
Log signal data that uses units by using Dataset or Timeseries logging format for signal logging, the To File block, and the To Workspace block. - Samples to Export for Variable-Step Solvers
Control how much output the simulation generates when your model uses a variable-step solver. Use the Output options configuration parameter. - Log Data to the Workspace and a File Using the Record Block
Use the Record block to log data to the workspace, to a file, or to both the workspace and a file.
Simulation State
- Save Block States and Simulation Operating Points
Learn how you can use state information logged from simulation and decide how to log states and operating points. - Save State Information
Save state information for logged states for each simulation step during a simulation.
Signal Logging
- Export Signal Data Using Signal Logging
To capture signal data from a simulation, you can use signal logging. Mark the signals that you want to log and enable signal logging for the model. - Configure a Signal for Logging
Mark the signals that you want to log simulation data for. - View the Signal Logging Configuration
View the signals that are marked for signal logging. - Enable Signal Logging for a Model
To log signals marked for signal logging, set the Signal logging configuration parameter. - Override Signal Logging Settings
For a specific simulation run, override the signal logging settings for individual signals marked for logging. - View and Access Signal Logging Data
View and access the signal logging data for a completed or paused simulation. - Convert Logged Data to Dataset Format
To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor. - Log Signals in For Each Subsystems
Use signal logging in For Each subsystems.
Data Stores
- Log Data Stores
Configure a data store for logging so that you can view the data stored in a simulation run.