What's the best way to change a simulink library name?

8 ビュー (過去 30 日間)
Jorhabib Eljaik
Jorhabib Eljaik 2014 年 5 月 27 日
回答済み: Lukas 2020 年 9 月 24 日
Hello there, I have created a simulink library for which I now want to change its name and propagate this to the paths of my library blocks. I understand you can use forwarding tables to update the paths of singles blocks but this way I would have to change them one by one and I already have too many blocks. I also tried changing the name given in the slblocks.m but the blocks paths won't automatically update. Is there any way to make my life easier?
Thanks in advance
  2 件のコメント
Raghunandan V
Raghunandan V 2019 年 3 月 21 日
Hi,
Is this question still open?
I have done something similar to this. I can answer you. Please send a library and a model for testing purpose. I will reply with the answer!
madhan ravi
madhan ravi 2019 年 3 月 21 日
編集済み: madhan ravi 2019 年 3 月 21 日
@Raghunandan please do!, OP may not reply because it's too old but you can provide your own to demonstrate.

サインインしてコメントする。

回答 (1 件)

Lukas
Lukas 2020 年 9 月 24 日
What about this?
% Find the library blocks in current system
h = find_system(gcs,'LinkStatus','resolved');
origlib = get_param(h,'ReferenceBlock');
oldlibname = 'myoldlib';
newlibname = 'mynewlib';
% Update the references to the new library
newlib = strrep(origlib,[oldlibname '/'],[newlibname '/']);
set_func = @(x,y) set_param(x,'ReferenceBlock',y);
cellfun(set_func,h, newlib);

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by