フィルターのクリア

control parameters of a simulink block

3 ビュー (過去 30 日間)
Owen
Owen 2012 年 8 月 27 日
Hi,
Is it possible to control parameters of a simulink block with another block? Say create a block which controls the 'seed' value of 'Random Number Generator'.
Thanks Senmeis

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 8 月 27 日
In general, this is not a supported workflow, please see How Do I Change a Block Parameter Based on the Output of Another Block? The suggested solution would be re-implement the block so that the parameter value is accepted via an input port.

その他の回答 (2 件)

Ryan G
Ryan G 2012 年 8 月 27 日
You can do this by utilizing a MATLAB function that can call the set_param command. You may be able to use the interpreted MATLAB function which would be similar but I never tested it for set_param.
However, you cannot change the seed of the random number generator during simulation as it is not tunable during simulation.

Owen
Owen 2012 年 8 月 28 日
Thank you, but I don't intend to set parameters during simulation, but before any simulation. In fact I must set the parameters 'Number of outputs' in all blocks 'Demux' in a model globally.
I think it is much easier than setting at runtime.
Thanks Senmeis
  2 件のコメント
TAB
TAB 2012 年 8 月 29 日
You can double click on the block and change the parameter value directly or you can you set_param function to set the parameters from command-line/m-script.
Isn't it works for you ?
Kaustubha Govind
Kaustubha Govind 2012 年 8 月 29 日
Owen: I see. Your question threw me off: "Is it possible to control parameters of a simulink block with another block?" - suggests that you want to control parameters based on the output of another block.
If you simply need to control parameters before running the model, please follow TAB's suggestion.

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

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by