Documentation

Data Logging

Log data to workspace during model simulation for subsequent data processing

Functions

simscape.logging.export Save logged simulation data in HDF5 file
simscape.logging.import Create simulation log variable to access data in HDF5 file
simscape.logging.plot Plot logged simulation data for node or series
simscape.logging.plotxy Plot logged simulation data for one node or series against another
simscape.logging.sli.findNode Find Node object corresponding to block or subsystem
simscape.logging.sli.findPath Find path to node in logged simulation data tree
sscexplore Open Simscape Results Explorer to interact with logged simulation data
sscprintzcs Print zero crossing information for logged simulation data

Classes

simscape.logging.Node Represent hierarchy tree for simulation data
simscape.logging.Series Represent time-value series for simulation data

Examples and How To

Enable Data Logging for the Whole Model

Using data logging is a best practice for Simscape™ models because it provides access to important simulation and analysis tools.

Log Data for Selected Blocks Only

Instead of logging the simulation data for the whole model, you can log data just for the selected blocks.

Log, Navigate, and Plot Simulation Data

This example shows the basic workflow for logging simulation data for the whole model and then navigating and plotting the logged data using Simscape Results Explorer.

Log and Plot Simulation Data

This example shows how you can log and plot simulation data instead of adding sensors to your model.

Log Simulation Statistics

This example shows how you can access and analyze information on zero crossings during simulation.

Log and View Simulation Data for Selected Blocks

This example shows how you can set your model to log simulation data for selected blocks only and how to view simulation data using Simscape Results Explorer.

Plot Simulation Data in Different Units

When you display logged simulation data in Simscape Results Explorer, the data along the x-axis is always time, in seconds.

Use Custom Units to Plot Simulation Data

Simscape Results Explorer has a set of default units for plotting the logged data.

View Sparkline Plots of Simulation Data

This example shows the basic workflow for viewing sparkline plots of logged simulation data for selected blocks and variables directly on the model canvas.

Concepts

About Simulation Data Logging

You can log simulation data to the workspace, or to a temporary file on disk, for debugging and verification.

Data Logging Options

When you set the Log simulation data configuration parameter to All or Use local settings, other options in the Data Logging group box become available.

Stream Logging Data to Disk

When you log simulation data, you can either store the data in a workspace variable, or stream the data to a temporary file on disk and have the workspace variable point to that temporary file.

About the Simscape Results Explorer

Simscape Results Explorer is an interactive tool that lets you navigate and plot the simulation data logging results.

Was this topic helpful?