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

조회 수: 7 (최근 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 CenterFile Exchange에서 Block Libraries에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by