필터 지우기
필터 지우기

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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by