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:
Set Logging Mode to
Override signals
.In the Model Hierarchy pane, select the node that you want to override the signal logging configuration for.
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 Box | Signal Logging Configuration |
---|---|
| 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. |
| 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. |
| For the top-level model node, logs all logged signals that have the
For a
Model block node, logs all logged signals in the model reference
hierarchy for that block that have the |
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)
, wheremdl
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 namedsineMdlRef
and a Random Number block. ThesineMdlRef
Model block has three outputs that are summed together to create thesineSum
signal.The
sineMdlRef
Model block contains three Sine Wave blocks with different amplitudes and a Model block namedsimpleConst
. The three outputs from thesimpleConst
Model block are summed together to create theconstSum
signal. Because thesineMdlRef
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
andrandomSig
.In the
sineMdlRef
model, four signals are marked for signal logging:Sine1
,Sine2
,Sine3
, andconstSum
.In the
simpleConst
model, three signals are marked for signal logging:Const1
,Const2
, andConst3
.
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.
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
.
For more information, see View Logging Configuration Using the Signal Logging Selector.
In the Signal Logging Selector, set Logging Mode to
Override signals
. Then, in the Model
Hierarchy pane:
Select the check box for the top-level model node.
Clear the check box for the
sineMdlRef
Model block node.
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.
sineMdlRef
ModelIn the Signal Logging Selector, set Logging Mode to
Override signals
. Then, in the Model Hierarchy
pane:
Clear the check box for the top-level model node.
Clear the check box for the
sineMdlRef
Model block node to disable logging for all signals in the model reference hierarchy for that block.Select the
sineMdlRef
Model block node. Then, in theDataLogging
column of the table, select all four signals in thesineMdlRef
model. Notice that the check box next to thesineMdlRef
model has changed to a horizontal dash. This change means that only those signals in the model reference hierarchy for that block that have theDataLogging
setting enabled are logged.
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.
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:
Clear the check box for the top-level model node.
Clear the check box for the
sineMdlRef
Model block node to disable logging for all signals in the model reference hierarchy for that block.Select the
simpleConst
node. Then, in theDataLogging
column of the table, select the check box corresponding to theConst1
signal.Select the
sineMdlRef
node. Then, in theDataLogging
column of the table, select the check box corresponding to theSine1
signal.Select the top-level model node. Then, in the
DataLogging
column of the table, select the check box corresponding to therandomSig
signal.
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.
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:
Clear the check box for the top-level model node.
Clear the check box for the
sineMdlRef
Model block node to disable logging for all signals in the model reference hierarchy for that block.Select the top-level model node. Then, in the
DataLogging
column of the table, select the check box corresponding to therandomSig
signal.In the
NameMode
column, from the drop-down list, selectcustom
.In the
LoggingName
column, entermySignalName
.
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
- View Logging Configuration Using the Signal Logging Selector
- Override Signal Logging Settings with Signal Logging Selector
Version History
Introduced in R2011a