モデル上の全ての信号​線に、信号ロギングの​チェックを自動で付け​ることができますか?

11 views (last 30 days)
MathWorks Support Team
MathWorks Support Team on 6 Jun 2018
規模の大きくないモデルを検討しており、モデル上の全ての信号線に信号ロギングのチェックを自動で付けたいと考えています。マウス操作で行うよりも手間のかからない、何か良い方法はあるか、教えて下さい。

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 6 Jun 2018
MATLAB コマンドウィンドウもしくは MATLAB ファイルとして、自動化の記述をして実行する方法が考えられます。
記述例を下記に示しますので、確認をすることができます。
%%ブロックの探索
blks = find_system(gcs,'LookUnderMasks','all','Type','Block');
N = length(blks);
%%全ブロックについてループにて処理する
for n=1:N
tmp = get_param(blks{n},'PortHandles');
% out 端のあるものについて...
if isempty(tmp.Outport) == 0
M = length(tmp.Outport) % ・・・ out 端の個数
for m = 1:M
set_param(tmp.Outport(m),'Name',['sig' num2str(n) '_' num2str(m)]); % 信号名を例えばこのように自動で付ける
set_param(tmp.Outport(m),'DataLogging','on'); % 信号のログ チェックを ON にする
end
end
end

More Answers (0)

Categories

Find more on モデルの入力と出力の準備 in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2010a

Community Treasure Hunt

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

Start Hunting!