set_param on block inside library

6 次查看(过去 30 天)
Aaron
Aaron 2015-5-18
编辑: Aaron 2015-5-20
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.

回答(2 个)

Sreeram Mohan
Sreeram Mohan 2015-5-19
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
  1 个评论
Aaron
Aaron 2015-5-19
Sreeram, Thanks for your response. I do not want to break the link (I should change my wording in the question to "disable link".)
The question is, how do I even disable the link to begin with. The block I found via the "find_system" command contains no information about it's parent library. For example under link status I see "inherited" and I am not able to execute the set_param('LinkStatus'....) on the block itself.
How do you retrieve library link information from a block within a linked library subsystem (that could be multiple levels of hierarchy within the library)?

请先登录,再进行评论。


Sreeram Mohan
Sreeram Mohan 2015-5-20
Hi Aaron,
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
  1 个评论
Aaron
Aaron 2015-5-20
Unfortunatly that does not help :) I just updated my original comment with a detail of my hierarchy. As I mention, directly using set_param('LinkStatus',....) on a block within a library does not work.
I could write my own script to go find the parent library but I was hoping there was a built in way to do this.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by