フィルターのクリア

How to change value of a constant block that's inside of a library

2 ビュー (過去 30 日間)
Bjoern
Bjoern 2012 年 6 月 11 日
I programmatically want to change the value of a Constant Block inside a library. It works great but I get a warning that I'm modifying the internals of a library block:
set_param(gcb, 'Value', '1');
Warning: Overriding parameters of 'MyModel/MyLib/Constant' which is inside a library link. These changes can be changed, propagated, or viewed using the 'Link Options' menu item
The intent of the library is to enable a GUI to change the Constant block during run-time hence I can't have the warnings.
.
I've tried to solve the issue by adding a library mask parameter to hold the value together with a callback updating the Constant block. This works except that the callback doesn't get executed during run-time (hence I can't change the parameter from GUI during run).
Please let me know how to do this. Thanks!!
  1 件のコメント
Bjoern
Bjoern 2012 年 6 月 11 日
BTW for the mask parameter mentioned above: If I could execute the "Mask Dialog Parameter Callback" after updating the value parameter my problem would be solved:
_set_param('MyModel/MyLib', 'MyGuiValue', '5');_
_??EXECUTE CALLBACK FOR MASK PARAMETER: MyGuiValue_

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

採用された回答

Bjoern
Bjoern 2012 年 6 月 11 日
I found a good way if anyone's interested:
Don't use a Mask Parameter-Callback to change the Constant Block. Instead, reference the Mask Parameter inside the Constant Block. Now all that is needed is to change the Mask Parameter (here MyGuiValue), something like:
set_param('MyModel/MyLib', 'MyGuiValue', '5')
and the simulation picks it up correctly.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by