Log a Subset of Signals without saving the model?

2 ビュー (過去 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.

カテゴリ

Help Center および File ExchangePrepare 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