How can I disable signal logging for all the signals in my model?

79 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 7 月 11 日
コメント済み: Stefanie Schwarz 2025 年 8 月 11 日
I've instrumented many signals in my Simulink model with the blue wi-fi badge. How can I disable data logging for all signals in my model?

採用された回答

MathWorks Support Team
MathWorks Support Team 2025 年 8 月 11 日
編集済み: MathWorks Support Team 2025 年 8 月 11 日

Option 1: Disable DataLogging programmatically

You can disable signal logging for all signals using the following code (replace 'gcs' with your model name if needed):
mdlsignals = find_system(gcs,'FindAll','on','LookUnderMasks','all','FollowLinks','on','type','line','SegmentType','trunk'); ph = get_param(mdlsignals,'SrcPortHandle'); for i=1: length(ph) set_param(ph{i},'DataLogging','off'); end
To disable signal logging across an entire Simulink model, including any library-linked sub-models, referenced models, reference and library models within variant subsystems, see:

Option 2: Consider Signal Logging Override

Alternatively, consider using Signal Logging Override. This lets you temporarily disable all logging via the Signal Logging Selector, and easily revert to your original settings later.
To access it, open the Simulink Toolstrip, go to the Simulation tab, then Prepare > Configure Logging, and click "Configure Signals to Log." At the top of the dialog, select "Override signals" and use Ctrl+A to select all signals on the right and disable DataLogging:
You can also configure how model references behave here. To restore your original setup, simply switch back to "Log all signals as specified in model."
If your model includes subsystems or model references, the UI workflow can be cumbersome since you need to go through each one individually. In such cases, you can automate the process programmatically: 
  3 件のコメント
Simon Silge
Simon Silge 2024 年 7 月 9 日
編集済み: Simon Silge 2024 年 7 月 9 日
Just to add another pointer: you can override your logging settings using the Signal Logging Selector and deactivate all logging for a model there. The advantage is that you can afterwards switch back to your original setup with all signals logging as specified before.
To open go to: Simulink Toolstrip: On the Modeling tab, click Model Settings > Data Import/Export. Then, click Configure Signals to Log.
On the top you can choose between different logging modes. Choose "Override signals". Next select all the signals on the list on the right (Ctrl+A to select all).
For model references you can also specify here how they should behave. When you want to go back to your original setting you can change from "override signals" to "Log all signals as specified in model".
If you have subsystems and model references the workflow via UI is still cumbersome as you need to go through them one by one. But you can also use this tool programmatically:
Stefanie Schwarz
Stefanie Schwarz 2025 年 8 月 11 日
We added Signal Logging Override as another option to the original answer. Thanks!

サインインしてコメントする。

その他の回答 (1 件)

Keqin Xu
Keqin Xu 2020 年 11 月 3 日
編集済み: Stefanie Schwarz 2025 年 8 月 11 日
I made a convenient shortcut out of the following script.
% this will remove logging of any selected signals in the Simulinkmodel
mn=inputdlg({'Input SimuLink Model Name:'},'',1,{''});
if ~isempty(mn)
if exist(mn{1})==4
mdlsignals = find_system(mn,'FindAll','on','LookUnderMasks','all','FollowLinks','on','type','line','SegmentType','trunk');
ph = get_param(mdlsignals,'SrcPortHandle');
for i=1: length(ph)
set_param(ph{i},'datalogging','off')
end
msgbox(['Any signal loggings in "',mn{1},'" have been removed.'])
else
msgbox(['"',mn{1},'" is not a valid Simulink model.'])
end
end

カテゴリ

Help Center および File ExchangeSave Run-Time Data from Simulation についてさらに検索

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by