SimScape Block Logging Programmatically?

1 回表示 (過去 30 日間)
Tommy
Tommy 2023 年 4 月 24 日
編集済み: Shivani 2023 年 5 月 4 日
Hello There,
I would like to know, if it is possible to set a block parameter programmatically to Log the local SimScape Data of a Block. Of course, I can do it by Hand (example), but I want to do this automatically using set_param() - function.

回答 (1 件)

Shivani
Shivani 2023 年 5 月 4 日
編集済み: Shivani 2023 年 5 月 4 日
Hi Tommy,
Data of an individual SimScape block can be logged programmatically by following the below mentioned steps:
  1. In the Model Settings dialog box choose the ‘User Local Settings’ in Log Simulation Data as shown in the diagram below.
2. Then create a new MATLAB script and run the below code to set data logging option to true.
modelName= 'NameOfSimScapeModel';
blockName = 'NameofBlock';
blockPath = getfullname([modelName '/' blockName]);
model_handle = get_param(blockPath,'Handle');
set_param(model_handle, 'LogSimulationData', 'on');
sim(modelName);
3. On running the above code, the preferred SimScape block will log output data
Hope this helps!

カテゴリ

Help Center および File ExchangeCreating Custom Components and Libraries についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by