Log a Subset of Signals without saving the model?

조회 수: 1(최근 30일)
Javier Cuadros
Javier Cuadros 2020년 10월 15일
답변: Shraddha Jain 2021년 3월 8일
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.

Community Treasure Hunt

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

Start Hunting!

Translated by