copying a simulink library block without its link
38 次查看(过去 30 天)
显示 更早的评论
Hi, I have a created a subsystem through s-function with variable number of inports. I want to use this library block at many places in my model assigning separate numbers of Inports. Problem comes when i close the model and open it again, at all the places i have same number of inports which is defined in library block, so I have to manually assign number of inports at all the place before running the simulation. I have overcome with this problem by disabling the link for each block with its library block. I am wondering is there any way by which I can assign a property to my library block so that whenever someone copies this block in his simulink model, it will disable its link automatically instead of doing it manually everytime?
Thanks,
采纳的回答
TAB
2012-6-14
If you have masked your block then it is easy to disable the link of block every time block is added in the model from library. In initialization pane of Mask Editor dialog box enter below command.
set_param(gcb,'LinkStatus','none');
If you are using block without masking, then in PreSaveFcn or PostSaveFcn callback function of your model, write code to find all your library blocks using find_system() and set their 'LinkStatus' to 'none'. In this way, when your model will be saved, library link will be disabled.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subsystems 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!