How to enter a value to a simulation while it is executing

C=a+b; For a=1:1:1000, b=1:1:1000,I want to calculate C Value,,,I will be putting delay after calulating one addition and thereafter I want to give a flexibility to put his\her own 'a','b' value ,,,while code is executing,,,,Is it possible in MATLAB script?,,,if possible ,can anyone give me the hint to perform it

 採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 11 月 26 日
編集済み: Kaustubha Govind 2012 年 11 月 26 日

0 投票

Assuming that the variables a and b correspond to tunable parameters of a block, you can indeed change the value of either variable in the MATLAB workspace and run set_param('modelname', 'SimulationCommand', 'update') to make the model notice the new values.
If 'a' and 'b' are signals, you may find this section in the documentation useful: Access Block Data During Simulation.

4 件のコメント

Arun Badigannavar
Arun Badigannavar 2012 年 11 月 28 日
Can you help me how to set block value as Tunable parameter,,can you post any simple example,,I tried in Setting in model explorer but am unable to perform it
Kaustubha Govind
Kaustubha Govind 2012 年 11 月 29 日
Not sure what you mean by "set block value as Tunable parameter" - the block itself decides whether or not a given parameter is tunable. You can test this by pausing an already running simulation, double-click on the block dialog and see if it is still editable. One tunable-parameters are editable during simulation.
Arun Badigannavar
Arun Badigannavar 2012 年 12 月 3 日
Thank you,,If I want to edit the values of tunnable parameters means I should pause the simulation?
Kaustubha Govind
Kaustubha Govind 2012 年 12 月 27 日
No, you should be able to edit the parameter by double-clicking on the block or using set_param('path/to/block', 'ParamName', 'ParamValue') followed by set_param('modelname', 'SimulationCommand', 'update').

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEvent Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by