Custom Library Blocks get reset to default value every time the model is closed.
4 views (last 30 days)
Show older comments
I have developed a small custom library for the logic that I reuse multiple times in the model of my current project. All these blocks have masks, such that, for example, if I enter the value "48" in the Edit Field on the mask dialog box, then the value of certain constant blocks inside the library block gets changed to 48. All blocks have "Modified parameter in link" written, since I'm changing the default value of the mask parameter. However, the value of all constant blocks inside these library subsystems gets reset to the default value whenever I try to build the model or open it again after closing (in short, the changes inside the blocks aren't being saved). Can anyone assist me with this?
I have attached a screenshot to show what my library block looks like in terms of the library links. Thanks in advance.
1 Comment
Answers (1)
Fangjun Jiang
on 11 Jan 2023
This is caused by improper mask or improper usage of a custom library block.
The proper way is to specify the Constant block value in the library as 'MyConst', mask it using the Edit field 'MyConst'.
In the model, drop the first copy, specify the value as 48. Drop a second copy, specify the value as 49.
In this case, the two Constnat blocks are still the same as the Constant block in the library. It's value is 'MyConst'.
For whatever reason, your usage caused a "Parameterized Link", which means in the first copy, the Constant value is 48, in the second copy, the Constant value is 49. That is what the text "Modified parameter in link" indicates.
The "Parameterized Link" should still be saved with the model and should not reset to the same as the library. Either your description of the problem is inaccurate, or, the Parameterized Link is somewhere else in the library but your Constant block value got reset. But still, how could the Constant block value got changed but the library link is still intact?
Anyway, Look at the document link below. There is a way to find out if there are Parameterized Links in the model. Parameterized Link shall be avoided if possible.
See Also
Categories
Find more on Subsystems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!