How do I suppress signal output from Simulink model?

16 ビュー (過去 30 日間)
HaMo
HaMo 2018 年 5 月 30 日
回答済み: Christopher Wallace 2018 年 6 月 6 日
I want to measure performance of my Simulink model using SimulationMetaData. The problem is the sim command also outputs all signals in workspace. For my example model (see screenshot) it is not a problem, but for a larger model with long simulation times it uses up too much memory, which in turn affects the execution time negatively.
Example:
simout = sim('DummyTest', 'ReturnWorkspaceOutputs', 'on')
yields
simout =
Simulink.SimulationOutput:
y: [1x1 timeseries]
SimulationMetadata: [1x1 Simulink.SimulationMetadata]
ErrorMessage: [0x0 char]
I can get rid of the 'y' field by typing
metadata = simout.getSimulationMetadata()
However I do not want it to be written to memory (as output to the function) in the first place. I have tried
set_param DummyTest SaveTime off SaveState off SaveOutput off SaveFinalState off
but to no avail.
UPDATE: The reason y is part of the output struct from the sim function is that it is stored to workspace with the 'To Workspace' block. Thus, Simulink does not return all signals in workspace, but instead it returns the signals that are saved to workspace.
In order to perform what is asked in the headline of this post, untick 'Configuration Parameters' / 'Data Import/Export' / 'Output'
I still do not know how to do it programatically though

採用された回答

Christopher Wallace
Christopher Wallace 2018 年 6 月 6 日
Hi HaMo,
To turn it off programatically try:
set_param(sys, 'SaveOutput', 'off')
Where 'sys' is the Simulink model your using. I used 'bdroot' to test it in Matlab 2017.
Best Regards,
Chris

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by