Log a Subset of Signals without saving the model?

1 visualización (últimos 30 días)
Javier Cuadros
Javier Cuadros el 15 de Oct. de 2020
Respondida: Shraddha Jain el 8 de Mzo. de 2021
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?

Respuestas (1)

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

Categorías

Más información sobre Prepare Model Inputs and Outputs en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by