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

205 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 7 月 11 日
回答済み: Keqin Xu 2020 年 11 月 3 日
I have enabled data logging for a lot of signals in my model, how can do this via command line functions?

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 7 月 11 日
The following code will disable signal logging for all the signals in the model ('gcs' can be replaced by the model name):
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
  1 件のコメント
Asvin Kumar
Asvin Kumar 2020 年 9 月 7 日
For those who want to copy paste this into a laaarge model...
...add a semicolon on line 2.
My ph variable had an output of length 2077x1. :/

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

その他の回答 (1 件)

Keqin Xu
Keqin Xu 2020 年 11 月 3 日
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 ExchangeModeling についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by