Log a Subset of Signals without saving the model?

1 次查看(过去 30 天)
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?

回答(1 个)

Shraddha Jain
Shraddha Jain 2021-3-8
Hi Javier,
Yes, you will have to save the model before simulating so as to lock the model override object settings.

类别

Help CenterFile Exchange 中查找有关 Prepare Model Inputs and Outputs 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by