Log a Subset of Signals without saving the model?
4 views (last 30 days)
Show older comments
Hello all,
I would like to collect certains subset of signals from my complex model, to do so I am following this link. I am interested only in the subset since the model logs more signals than I am interested in at this moment, but I don't want to disable all the logged signals of the model.
My code looks like this
mdl = 'myModelA';
load_system(mdl);
% Get model info regarding to which signals are currently being logged
ov = Simulink.SimulationData.ModelLoggingInfo(mdl);
% Define those signals that we are interested on replacing to be logged
blkPort = 1;
so(1) = Simulink.SimulationData.SignalLoggingInfo([mdl '/|(x[n]+r_thermal[n])*Glna|'],blkPort);
so(2) = Simulink.SimulationData.SignalLoggingInfo([mdl '/was_abort_triggered_monitoring'],blkPort);
so(3) = Simulink.SimulationData.SignalLoggingInfo([mdl '/validACQ'],blkPort);
so(4) = Simulink.SimulationData.SignalLoggingInfo([mdl '/PER_ACQ'],blkPort);
% Replace original signals to debug by the ones in so vector
ov.Signals = so;
% apply this object so the model
set_param(mdl,'DataLoggingOverride',ov);
for currentPower=1:2
iterationOutput = sim(mdl);
simulationOutput{currentPower} = iterationOutput;
clear "iterationOutput"
end
Reading the link it's there stated that Simulink saves the settings when you save the model. Does this mean that I have to save the model before simulating the model?
0 Comments
Answers (1)
Shraddha Jain
on 8 Mar 2021
Hi Javier,
Yes, you will have to save the model before simulating so as to lock the model override object settings.
0 Comments
See Also
Categories
Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!