Firstly, the following page indicates that you should set "LoggingMode" to "OverrideSignals" to control the logging mode for the top level model and all referenced models.
It is also possible to use a mix of override signal logging settings and model-specified (ignore override) logging settings using an cell array for "LogAsSpecifiedByModels".
Secondly, the following example walks through how you can selectively modify the "ModelLoggingInfo" for specific models in a reference hierarchy, and "DataLogging" settings for specific signals within those models.
Pay particular attention to the "Log a Subset of Signals" example. It uses "findSignal" and a loop to change the "DataLoggingOverride" settings for each signal.
mi = Simulink.SimulationData.ModelLoggingInfo.createFromModel(...
'ex_bus_logging');
pos = mi.findSignal({'ex_bus_logging/CounterA' ...
'ex_mdlref_counter_bus/Bus Creator'}, 1)
for idx=1:length(mi.Signals)
mi.Signals(idx).LoggingInfo.DataLogging = (idx == pos);
end
To apply the override settings, you use the following syntax:
set_param(ex_bus_logging,'DataLoggingOverride', mi);
To save the "Override Signals" configuration to apply it later, use "get_param" as follows:
>>si = get_param(bdroot,'DataLoggingOverride')
Best Answer