enable log signals through command line.

12 ビュー (過去 30 日間)
Pika
Pika 2012 年 7 月 20 日
コメント済み: Cou 2020 年 7 月 27 日
I have several reference models which has logging/test point signals. I use Simulink Signal Logging Selector to enable/disable these signals but I would like to do this through the command line. How do I do this? I have tried Simulink.SimulationData.ModelLoggingInfo.createFromModel. What do i do after this? I also then tried findSignal but it always comes back with an empty array.

採用された回答

Albert Yam
Albert Yam 2012 年 7 月 20 日
編集済み: Albert Yam 2012 年 7 月 20 日
I remember doing this before, but I can't find the code. I had to : 1) find the block 2) get the line (out of the block) 3) go back and find the source port 4) set your options there
lh=get_param(gcb,'LineHandles');
lhh=get_param(lh.Outport,'Handle');
sph =get_param(lhh,'SrcPortHandle');
set_param(sph,'DataLogging',1); %this changed for newer versions I think
get_param(sph,'ObjectParameters') %there will be other things you will want
%decimation, limit results to last XX points
Edit:I'm using Simulink 6.6.1, so things might be different now.

その他の回答 (1 件)

Cou
Cou 2017 年 11 月 13 日
I realize this is an old thread and an answer has been accepted, however it appears at the top of google search results. I thought I'd add a method that preserves the logged signal in the Simulink model but programmatically disables logging. The code below is essentially the same as unchecking the "DataLogging" boxes in the Simulink Signal Logging Selector. Make sure logging mode is set to "Override signals." This tutorial was helpful as well: Log Data in Library Charts
mi = Simulink.SimulationData.ModelLoggingInfo.createFromModel(gcs);
for i = 1:numel(mi.Signals)
mi.Signals(i).LoggingInfo.DataLogging = 0;
end
set_param(gcs, 'DataLoggingOverride', mi)
  2 件のコメント
Mariam Achraf
Mariam Achraf 2020 年 7 月 26 日
編集済み: Mariam Achraf 2020 年 7 月 26 日
Hello,
which version are you using please ?,as I can not seem to find this option 'DataLoggingOverride' any where in the data Import window
Cou
Cou 2020 年 7 月 27 日
I am using 2016b.

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

カテゴリ

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