Main Content

Log Data for Selected Blocks Only

Instead of logging Simscape™ simulation data for the whole model, you can log data just for the selected blocks. The simulation log then contains logged data for all of the variables in the selected blocks.


Alternatively, you can add instrumentation to Simscape blocks by selecting individual variables to log in a Simulink.SimulationOutput object, along with Simulink® variables and signals. For more information, see Log Selected Block Variables.

To enable Simscape data logging just for the selected blocks:

  1. In the model window, open the Modeling tab and click Model Settings. The Configuration Parameters dialog box opens.

  2. 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.

  3. Set the logging configuration parameter to enable simulation data logging on a block-by-block basis.

    In the Configuration Parameters dialog box, in the left pane, select Simscape, then set the Log simulation data parameter to Use local settings. Click OK.

  4. Select the blocks in your model. You can do this before or after setting the logging configuration parameter.

    For each block that you want to select for data logging, right-click the block. From the context menu, select Simscape > Log simulation data. A check mark appears in front of the Log simulation data option.

  5. Simulate the model. When the simulation is done, the simulation data log contains only the data from the selected blocks.

To stop logging data for a previously selected block, right-click it and select Simscape > Log simulation data again to remove the check mark.

If you set the Log simulation data parameter to All, the simulation log will contain data from the whole model, regardless of the block selections. Setting the Log simulation data parameter to None disables data logging for the whole model.

Related Examples

More About