About Selective Logging
To log individual block variables in Simscape™ blocks and combine the logs with Simulink data, use selective logging. You can use selective logging in addition to Simscape data logging, or you can use selective logging exclusively.
Simscape Data Logging and Selective Logging
Unlike Simscape data logging, which logs data from the entire model or block, you can use selective logging to log individual Simscape block variables and combine logs with Simulink® signals that have logging enabled. This table shows the differences between selective logging and Simscape data logging:
Logging Method | Logged Data | Output Object | Tool to View Data |
---|---|---|---|
Simscape data logging | Whole model or all of the variables for selected blocks | simscape.logging.Node ,
simscape.logging.Series | Simscape Results Explorer or Simulation Data Inspector |
Selective logging | Selected individual variables from any Simscape block in the model | Simulink.SimulationData.Dataset | Simulation Data Inspector |
Logging and Visualizing Selected Block Variables
To specify a variable for selective logging, use the Instrumentation table in the Simscape Variables tab of the Model Data Editor. Select a Simscape block in the model and, in the Simscape Block tab, select Log Variables > Instrumentation Table. Selecting a block variable enables the block for logging and logs that block variable when you simulate the model. When the Simscape block has logging enabled, the block displays the logging badge. You can also log individual block variables in a model reference by navigating to the referenced model in the canvas and configuring the variables in the Instrumentation table. To learn more, see Log Selected Block Variables.
When you run the simulation, the variable data saves to logsout
, the
default Simulink.SimulationData.Dataset
object workspace variable. You can
also view the results in the Simulation Data
Inspector.
You can manage selective logging tasks from the MATLAB command window. When you
instrument your model programmatically, you can automate logging tasks to perform them
across multiple models or simulations. Simscape stores the logging configuration data in
your model file, where each block has a variable table and each variable configuration is
defined by a VariableConfiguration
object. You can configure the variable
alias, the units, and whether to enable logging. After you run the simulation, you can
access the recorded data from the logsout
workspace variable. To learn
more, see Log Selected Variables Programmatically.
Limitations
Selective logging does not support:
Component arrays.
Logging derived frequency variables.
Conditionally declared components. For composite components, this limitation includes all the externally accessible variables of conditionally declared components.
Multibody visualization when using rapid accelerator mode.
See Also
Simulation Data Inspector | Model Data Editor