MATLAB Examples

Save and Restore a Set of Logged Signals

This example shows the capability of using the Simulink.HMI.InstrumentedSignals object to save a set of logged signals to restore after running a simulation with a different set of signals.

Contents

Load Model and Save Initial Configuration

Load the sldemo_fuelsys model, and save the initial set of logged signals.

% Load model
load_system sldemo_fuelsys

% Get Simulink.HMI.InstrumentedSignals object
initSigs = get_param('sldemo_fuelsys', 'InstrumentedSignals');

% Save logging configuration to file for future use
save initial_instSigs.mat initSigs

Remove All Logging Badges

Return to a baseline of no logged signals so you can easily select a different configuration of signals to log.

% Clear all logging signals
set_param('sldemo_fuelsys', 'InstrumentedSignals', [])

Restore Saved Logging Configuration

After working with a different set of logged signals, you can easily restore a saved configuration with the Simulink.HMI.InstrumentedSignals object.

% Load the saved configuration
load initial_instSigs.mat

% Restore logging configuration
set_param('sldemo_fuelsys', 'InstrumentedSignals', initSigs)