How to set default value for instance parameters​/Simulink.​Parameter?

6 ビュー (過去 30 日間)
Malte Kliemann
Malte Kliemann 2020 年 12 月 10 日
コメント済み: Paul 2020 年 12 月 13 日
When using a ModelReference block, all instance parameters default to value [], even though they are define using a Simulink.Parameter object with a defined Value field (I expected the Value field to serve as default value for the specified instance parameter).
How can I set a default value for an instance parameter?
Please note that I sometimes want to use the default value, and sometimes don't. If I don't use a default value, I want to be able to programatically define the value of the parameter using this guide: https://de.mathworks.com/help/simulink/ug/parameterize-referenced-models-example.html

回答 (1 件)

Mark McBroom
Mark McBroom 2020 年 12 月 12 日
You will need to configure the parameter as a model argument and then specify values for each isntance of the model block. It is a bit tricky. This link gives step by step instructions.
  3 件のコメント
Mark McBroom
Mark McBroom 2020 年 12 月 13 日
I don't think there is a way for a given model to sometimes have the parameter passed as an argument and other times have a default value used.
Thanks.
Mark.
Paul
Paul 2020 年 12 月 13 日
That’s really unfortunate. I’ve been wanting this behavior for some time.

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

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by