Main Content

Data Logging

Log data to workspace during model simulation for subsequent data processing

You can log simulation data to the workspace, or to a temporary file on disk, for debugging and verification. Data logging lets you analyze how internal block variables change with time during simulation. If you log simulation data, you can later query, plot, and analyze it without rerunning the simulation. You can use Simscape™ data logging and selective logging instrumentation to log block variable data.

Simscape data logging logs all variables for selected blocks or for all blocks in the model and outputs the data to the simulation log workspace variable. You can interactively visualize and navigate the Simscape data logging results with the Simscape Results Explorer tool. You can use data logging and the Simscape Results Explorer to view simulation results, instead of adding sensors and scopes to your model. To learn more, see Log, Navigate, and Plot Simulation Data.

Selective logging logs only the selected variables on the blocks with logging enabled. Simscape logs the variables to a Simulink.SimulationData.Dataset object, along with Simulink® signals. You can enable selective logging for Simscape blocks with the user interface. You can view and select block variables for logging in the Instrumentation Table without compiling the model. To visualize the selective logging results, use the Simulation Data Inspector. To learn more, see Log Selected Block Variables.

You also manage selective logging instrumentation programmatically. To learn more, Log Selected Variables Programmatically.

Tools

Simscape Results ExplorerNavigate and plot simulation data logging results

Functions

expand all

simscape.logging.NodeHierarchy tree for simulation data
simscape.logging.SeriesTime-value series for simulation data
simscape.logging.exportSave logged simulation data in MLDATX file
simscape.logging.importCreate simulation log variable to access data in MLDATX file
simscape.logging.plotPlot logged simulation data for Node or Series
simscape.logging.plotxyPlot logged simulation data for one node or series against another
simscape.logging.findNodeFind Node object corresponding to block or subsystem (Since R2020a)
simscape.logging.sli.findNode(To be removed) Find Node object corresponding to block or subsystem
simscape.logging.findPathFind path to node in logged simulation data tree (Since R2020a)
simscape.logging.sli.findPath(To be removed) Find path to node in logged simulation data tree
simscape.logging.getSimulationLogIdentify latest Simscape simulation log for a model (Since R2024a)
simscape.logging.timestampDetermine whether simulation log is current or stale (Since R2021a)
sscexploreOpen Simscape Results Explorer to interact with logged simulation data
sscprintzcsPrint zero crossing information for logged simulation data
simscape.instrumentation.VariableTableStore and manage block variable data (Since R2024a)
simscape.instrumentation.VariableConfigurationConfiguration for variable (Since R2024a)
simscape.instrumentation.defaultVariableTableReturn default VariableTable object for block (Since R2024a)
simscape.instrumentation.setVariableTableSet VariableTable object for block (Since R2024a)
simscape.instrumentation.getVariableTableGet current VariableTable object for block (Since R2024a)
simscape.instrumentation.enableLoggingEnable logging for block (Since R2024a)
simscape.instrumentation.disableLoggingDisable logging for block (Since R2024a)
simscape.instrumentation.isLoggingEnabledReturns whether logging is enabled for a block (Since R2024a)

Topics

Simscape Data Logging

Selective Logging