How can I run simulink one sample at a time?

7 ビュー (過去 30 日間)
Luuk Spin
Luuk Spin 2022 年 12 月 1 日
編集済み: Sara Nadeau 2022 年 12 月 2 日
Dear matlab user,
I know how to run a simulink model from a script, e.g. 'sim('model_name.slx')'.
I would like to run this model one step at a time so that I can update my controller parameters iteratively. How can I achieve this?
With kind regards,
Luuk Spin
  1 件のコメント
Benjamin Thompson
Benjamin Thompson 2022 年 12 月 1 日
This can be done easily from the Simulink user interface using the Debug controls. Many block parameters are tunable while the model is running or halted in the debug mode. The Simulink Dashboard library also has a number of user interface blocks that can be linked to parameters in your model and changed dynamically while the model is running.

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

回答 (2 件)

Sara Nadeau
Sara Nadeau 2022 年 12 月 1 日
編集済み: Sara Nadeau 2022 年 12 月 2 日
What the other comment recommends, using sldebug, is the programmatic interface for low-level debugging of simulations. Based on what you describe, this might be more than you need. The sldebug interface can require a fair amount of knowledge about the software.
There are also options for stepping simulations one time step at a time on the Debug tab of the toolstrip. The doc currently refers to this as the "Simulation Stepper". It sounds like this would suit your needs and it's much simpler and more interactive. Here's a link to the doc on these features: https://www.mathworks.com/help/simulink/simulation-stepper.html
If you are looking to do this programmatically, there isn't a feature designed for that. While the sldebug interface is a programmatic debugging interface, it isn't supported for scripting. sldebug is meant for an interactive workflow where you enter commands in the Command Window.

Fangjun Jiang
Fangjun Jiang 2022 年 12 月 1 日
step top

カテゴリ

Help Center および File ExchangeDebug Simulations Programmatically についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by