Using data logging is a best practice for Simscape™ models because it provides access to important simulation and analysis tools.
Therefore, when you create a model by using the
ssc_new function or any of the Simscape model templates, data logging for the whole model is turned on automatically.
However, for models created using other methods, simulation data is not logged by default. To turn on the data logging for a model, use the Log simulation data configuration parameter.
In the model window, open the Modeling tab and click Model Settings. The Configuration Parameters dialog box opens.
In the Configuration Parameters dialog box, in the left pane, select Data Import/Export. Clear the Single simulation output check box, which is selected by default. This step enables associating the logged simulation data with a separate workspace variable, instead of it being part of the single output object.
In the Configuration Parameters dialog box, in the left pane, select
Simscape. The right pane displays the Log simulation
data option, which is by default set to
From the drop-down list, select
All, then click
Simulate the model. This creates a workspace variable named
(as specified by the Workspace variable name parameter), which
contains the simulation data.
For information on how to access and use the data stored in this variable, see the related examples listed below. For information on additional data logging configuration options, see Data Logging Options.