Main Content

Signal Logging Selector

View signal logging configuration and override signal logging settings

Description

The Signal Logging Selector in Simulink® allows you to view a signal logging configuration, including signal logging override settings. You can also use the Signal Logging Selector to override signal logging settings without changing the model in the Simulink Editor. When you override signal logging settings, you select a subset of signals to log from a superset of signals marked for logging in the model without changing the model itself. Overriding signal logging settings allows you to reduce memory overhead and avoid recompiling a model.

To override signal logging settings:

  1. Set Logging Mode to Override signals.

  2. In the Model Hierarchy pane, select the node that you want to override the signal logging configuration for.

  3. Use the table to select a subset of signals to log or override other signal logging properties.

For more information about overriding the signal logging configuration, see Override Signal Logging Settings.

When a model includes referenced models, the check box in the Model Hierarchy pane indicates the override configuration for the model corresponding to the node.

Check BoxSignal Logging Configuration

Filled box with white check mark

For the top-level model node, logs all logged signals in the top model.

For a Model block node, logs all logged signals in the model reference hierarchy for that block.

Empty box

For the top-level model node, disables logging for all logged signals in the top-level model.

For a Model block node, disables logging for all signals in the model reference hierarchy for that block.

Filled box with white dash

For the top-level model node, logs all logged signals that have the DataLogging setting enabled.

For a Model block node, logs all logged signals in the model reference hierarchy for that block that have the DataLogging setting enabled.

Signal Logging Selector

Open the Signal Logging Selector

  • Simulink Toolstrip: On the Modeling tab, click Model Settings. Then, click Configure Signals to Log.

  • MATLAB® Command Window: Enter Simulink.SimulationData.signalLoggingSelector(mdl), where mdl is the name of the model for which you want to open the Signal Logging Selector dialog box, specified as a character vector.

The Signal Logging Selector cannot be opened when a model uses a configuration reference. For more information, see Share a Configuration with Multiple Models.

Examples

Override Signal Logging Settings

You can use the Signal Logging Selector to enable or disable logging for all or some of the signals marked for signal logging in a model. If your model uses model referencing, which is to say that the model includes at least one Model block, you can override signal logging settings in the top-level model, throughout a referenced model hierarchy, or for specific signals. You can also use the Signal Logging Selector to override specific signal logging properties.

The model used in this example has three levels in the model hierarchy:

  • The top-level model topMdlSigLogSelector contains a Model block named sineMdlRef and a Random Number block. The sineMdlRef Model block has three outputs that are summed together to create the sineSum signal.

  • The sineMdlRef Model block contains three Sine Wave blocks with different amplitudes and a Model block named simpleConst. The three outputs from the simpleConst Model block are summed together to create the constSum signal. Because the sineMdlRef Model block contains another Model block, sineMdlRef is said to be at the top of a model referencing hierarchy.

  • The simpleConst Model block contains three Constant blocks with three different values.

Signal logging is used throughout the model hierarchy:

  • In the top-level model, two signals are marked for signal logging: sineSum and randomSig.

  • In the sineMdlRef model, four signals are marked for signal logging: Sine1, Sine2, Sine3, and constSum.

  • In the simpleConst model, three signals are marked for signal logging: Const1, Const2, and Const3.

Open and simulate the top-level model to log signal data without applying override settings.

openExample(“simulink/OverrideSignalLoggingConfigurationExample”)
mdl = "topMdlSigLogSelector";
open_system(mdl)
out = sim(mdl);

Simulation results are stored in a single Simulink.SimulationOutput object named out. The SimulationOutput object contains a property named logsout that contains the logged signal data. To access the logged signal data, use dot notation.

out.logsout
ans = 

Simulink.SimulationData.Dataset 'logsout' with 9 elements

                         Name       BlockPath                                
                         _________  ________________________________________ 
    1  [1x1 Signal]      randomSig  topMdlSigLogSelector/Random Number      
    2  [1x1 Signal]      sineSum    topMdlSigLogSelector/Sum1               
    3  [1x1 Signal]      Sine1      ...ogSelector/Model|sineMdlRef/Sine Wave
    4  [1x1 Signal]      Sine2      ...gSelector/Model|sineMdlRef/Sine Wave1
    5  [1x1 Signal]      Sine3      ...gSelector/Model|sineMdlRef/Sine Wave2
    6  [1x1 Signal]      constSum   ...lSigLogSelector/Model|sineMdlRef/Sum1
    7  [1x1 Signal]      Const1     ...sineMdlRef/Model|simpleConst/Constant
    8  [1x1 Signal]      Const2     ...ineMdlRef/Model|simpleConst/Constant1
    9  [1x1 Signal]      Const3     ...ineMdlRef/Model|simpleConst/Constant2

  - Use braces { } to access, modify, or add elements using index.
Open the Signal Logging Selector

To open the Signal Logging Selector, on the Modeling tab, click Model Settings to open the Configuration Parameters dialog box. Then, in the Data Import/Export pane, click Configure Signals to Log. The Signal logging configuration parameter must be selected to enable the Configure Signals to Log button.

In the Model Hierarchy pane, you can click the expander next to the simpleSign model node to see the full model hierarchy. By default, Logging Mode is set to Log all signals as specified in model. With this setting, all signals marked for signal logging in the model are logged and override settings cannot be applied.

To override signal logging settings, set Logging Mode to Override signals.

The Signal Logging Selector

For more information, see View Logging Configuration Using the Signal Logging Selector.

Log Only Signals in Top-Level Model

In the Signal Logging Selector, set Logging Mode to Override signals. Then, in the Model Hierarchy pane:

  1. Select the check box for the top-level model node.

  2. Clear the check box for the sineMdlRef Model block node.

The Signal Logging Selector configured to log only the signals in the top-level model.

Simulate the model again. Then, view the logged signal data. Only the two signals in the top-level, randomSig and sineSum, are logged.

out = sim(mdl);
out.logsout
ans = 
Simulink.SimulationData.Dataset 'logsout' with 2 elements

                         Name       BlockPath                          
                         _________  __________________________________ 
    1  [1x1 Signal]      randomSig  topMdlSigLogSelector/Random Number
    2  [1x1 Signal]      sineSum    topMdlSigLogSelector/Sum1         

  - Use braces { } to access, modify, or add elements using index.
Log Only Signals in sineMdlRef Model

In the Signal Logging Selector, set Logging Mode to Override signals. Then, in the Model Hierarchy pane:

  1. Clear the check box for the top-level model node.

  2. Clear the check box for the sineMdlRef Model block node to disable logging for all signals in the model reference hierarchy for that block.

  3. Select the sineMdlRef Model block node. Then, in the DataLogging column of the table, select all four signals in the sineMdlRef model. Notice that the check box next to the sineMdlRef model has changed to a horizontal dash. This change means that only those signals in the model reference hierarchy for that block that have the DataLogging setting enabled are logged.

The Signal Logging Selector configured to log only the signals marked for logging in the simpleSine model

Simulate the model again. Then, view the logged signal data. Now, only the four signals marked for logging in the sineMdlRef model are logged.

out = sim(mdl);
out.logsout
ans = 
Simulink.SimulationData.Dataset 'logsout' with 4 elements

                         Name      BlockPath                                
                         ________  ________________________________________ 
    1  [1x1 Signal]      Sine1     ...ogSelector/Model|sineMdlRef/Sine Wave
    2  [1x1 Signal]      Sine2     ...gSelector/Model|sineMdlRef/Sine Wave1
    3  [1x1 Signal]      Sine3     ...gSelector/Model|sineMdlRef/Sine Wave2
    4  [1x1 Signal]      constSum  ...lSigLogSelector/Model|sineMdlRef/Sum1

  - Use braces { } to access, modify, or add elements using index.
Log Subset of Signals from Throughout the Model Hierarchy

Using the Signal Logging Selector, you can log a subset of signals from a larger superset of signals marked for signal logging. This approach can be helpful when you want to test parts of your model. For example, you can log only the randomSig, Sine1, and Const1 signals.

In the Signal Logging Selector, set Logging Mode to Override signals. Then, in the Model Hierarchy pane:

  1. Clear the check box for the top-level model node.

  2. Clear the check box for the sineMdlRef Model block node to disable logging for all signals in the model reference hierarchy for that block.

  3. Select the simpleConst node. Then, in the DataLogging column of the table, select the check box corresponding to the Const1 signal.

  4. Select the sineMdlRef node. Then, in the DataLogging column of the table, select the check box corresponding to the Sine1 signal.

  5. Select the top-level model node. Then, in the DataLogging column of the table, select the check box corresponding to the randomSig signal.

The Signal Logging Selector configured to log only the randomSig, Sine1, and Const1 signals.

Simulate the model again. Then, view the logged signal data. Only the randomSig, Sine1, and Const1 signals are logged.

out = sim(mdl);
out.logsout
ans = 
Simulink.SimulationData.Dataset 'logsout' with 3 elements

                         Name       BlockPath                                
                         _________  ________________________________________ 
    1  [1x1 Signal]      randomSig  topMdlSigLogSelector/Random Number      
    2  [1x1 Signal]      Sine1      ...ogSelector/Model|sineMdlRef/Sine Wave
    3  [1x1 Signal]      Const1     ...sineMdlRef/Model|simpleConst/Constant

  - Use braces { } to access, modify, or add elements using index.
Override Other Signal Logging Properties

In addition to overriding the setting for the DataLogging property for a signal, you can override other signal logging properties, such as decimation. For example, you can log only the randomSig signal and change the logging name to mySignalName.

In the Signal Logging Selector, set Logging Mode is set to Override signals. Then, in the Model Hierarchy pane:

  1. Clear the check box for the top-level model node.

  2. Clear the check box for the sineMdlRef Model block node to disable logging for all signals in the model reference hierarchy for that block.

  3. Select the top-level model node. Then, in the DataLogging column of the table, select the check box corresponding to the randomSig signal.

  4. In the NameMode column, from the drop-down list, select custom.

  5. In the LoggingName column, enter mySignalName.

The Signal Logging Selector configured to log only the randomSig signal with the logging name changed to mySignalName.

Simulate the model again. Then, view the logged signal data. Only the randomSig signal is logged with the name mySignalName.

out = sim(mdl);
out.logsout
ans = 
Simulink.SimulationData.Dataset 'logsout' with 1 element

                         Name          BlockPath                          
                         ____________  __________________________________ 
    1  [1x1 Signal]      mySignalName  topMdlSigLogSelector/Random Number

  - Use braces { } to access, modify, or add elements using index.

Related Examples

Version History

Introduced in R2011a