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.
Open the Permanent Magnet DC Motor example model. At the MATLAB® command prompt, enter:
Double-click the DC Motor subsystem to open it.
Open the Configuration Parameters dialog box and then, in the left pane, select Simscape. This example model has data logging for the whole model enabled. To enable data logging on a block-by-block basis, set the Log simulation data parameter to
Use local settingsand click OK.
Select the blocks for data logging. Click the Rotational Electromechanical Converter block, and then, on the Simscape Block tab, click Log Data and select the Log Data check box.
Right-click the Inertia block and select it for data logging, as described in the previous step.
Simulate the model. This creates a workspace variable named
simlog_PermanentMagnetDCMotor(as specified by the Workspace variable name parameter), which contains the simulation data for selected blocks only.
To open the Simscape Results Explorer, click one of the blocks previously selected for data logging, for example, the Rotational Electromechanical Converter block, and then, on the Simscape Block tab, click Results Explorer.
The Simscape Results Explorer window opens, with the
Rotational Electromechanical Converternode already selected in the left pane and all the node plots for this block displayed in the right pane. You can see that it contains simulation data only for the two selected blocks, Rotational Electromechanical Converter and Inertia.