set_param on block inside library
7 views (last 30 days)
Show older comments
I am using the command:
find_system(....,'FollowLinks','on'....)
to find blocks in my system. I then am running
set_param(...'AttributesFormatString',...)
on the blocks that have been found to add some labels.
How do I use "set_param" to change parameters inside library links properly. I would imagine I need to disable the link, set the param, and then restore the link -or- open the referenced library for the block and edit the library directly.
Any suggestions/ideas on the best way to do this?
----------Update---------
Here is an example of my hierarchy:
mybench -> Subsystem_top -> subsystem_bot -> Constant
Subsystem_top is a library block from mylib_a/Subsystem Subsystem_bot is a library block from mylib_b/Subsystem
The find_system is returning the handle for the constant. I want to use set_param on the constant and update it's properties within the library mylib_b.
0 Comments
Answers (2)
Sreeram Mohan
on 19 May 2015
Hi Aaron,
It purely depends on what is the final intention. For example : Case 1: If you make some changes to the link (that is the block used in the model) and want to propagate the change to all the instances of the block in all models you should do a propagate. In this case Just disable the link, make the set_param and then propagate the change to the library. Case 2: If you want to just locally modify the link and then do not want to keep the relationship with the library. Then you could break the link. If you do so then you permanently loose the relationship with the library. If this is the intention. You just need to break the link and then do set_param at the cost that you no longer have a connection with the library or any other instances and you are working on a stand alone copy or (broken link) .
Hope this helps,
--sreeram
Sreeram Mohan
on 20 May 2015
Hi Aaron,
Please take a look at this link http://in.mathworks.com/help/simulink/ug/working-with-library-links.html
If you want to disable a link you would just call set_param(block, 'LinkStatus','inactive');
The table in the link that I have posted has all the values that can help with the library links.
Hope this helps !!
Sreeram
See Also
Categories
Find more on Model, Block, and Port Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!