This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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.

  1. Open the Permanent Magnet DC Motor example model by typing ssc_dcmotor in the MATLAB® Command Window. Double-click the DC Motor subsystem to open it.

  2. 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 settings and click OK.

  3. Select the blocks for data logging. Right-click the Rotational Electromechanical Converter block. From the context menu, select Simscape > Log simulation data .

    After you select a block for data logging, a check mark appears in front of the Log simulation data option in the context menu for that block.

  4. Right-click the Inertia block and select it for data logging, as described in the previous step.

  5. Simulate the model. This creates a workspace variable named simlog_ssc_dcmotor (as specified by the Workspace variable name parameter), which contains the simulation data for selected blocks only.

  6. To open the Simscape Results Explorer, right-click one of the blocks previously selected for data logging, for example, the Rotational Electromechanical Converter block. From the context menu, select Simscape > View simulation data > simlog_ssc_dcmotor.

    Note

    If you right-click a block that has not been selected for simulation data logging, for example, the Load Torque block, the View simulation data option is not available.

    If you change the name of the log variable between simulation runs, the context menu lists the names of all the log variables associated with the block. For example, to compare data from two simulation runs, you can use different variable names (such as simlog1 and simlog2). Open a Simscape Results Explorer window with simlog1 results, then unlink it from the session and open another window with simlog2 results. For more information, see About the Simscape Results Explorer.

    The Simscape Results Explorer window opens, with the Rotational_Electromechanical_Converter node 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.

Related Examples

More About