Most SimEvents® blocks can produce one or more statistical output signals.
This procedure shows you how to access a statistical output signal for a given SimEvents block.
Determine which statistical output signal you want to access and find the associated parameter in the block dialog box. To see which statistics are available, open the block dialog box. Usually, the list of available statistics appears as a list of parameters on the Statistics tab of the dialog box. In cases where the dialog box has no Statistics tab, the dialog box has so few parameters that the parameters associated with statistics are straightforward to locate.
Select the check box. After you apply the change, the block has a new signal output port corresponding to that statistic.
Connect the new signal output port to the signal input port of another block. The table lists some common examples.
Note: Use scopes and other observer blocks to observe individual statistic ports. However, you cannot use the same scope to observe multiple statistics ports. To observe multiple statistic ports, consider using a dashboard or the Simulation Data Inspector.
|If You Want to...||Use this Block...|
Create a plot using the statistic.
Simulink® Scope or dashboard
Show the statistic on the block icon throughout the simulation.
Simulation Data Inspector or Display
Write the data set to the MATLAB® workspace when the simulation stops or pauses. To learn more, see Save Simulation Data.
Signal logging or To Workspace. In addition, you can also log signals observed using scopes and Simulation Data Inspector to the workspace.
Perform custom data processing. See Derive Custom Statistics for some suggestions.
Custom subsystem or computational block
You can use the built-in statistical signals from SimEvents blocks to derive more specialized or complex statistics that are meaningful in your model. One approach is to compute statistics during the simulation. You can implement your computations using a graphical block-diagram approach or a nongraphical coded approach. Alternatively, you can compute statistics using MATLAB code after the simulation is complete.