Unresolved linked library block: How to change the source block programmatically?

조회 수: 26 (최근 30일)
Hi,
assume you have a linked library block in your model. The library is in the path and can be found, so the block is resolved and regularily displayed.
Now you change the library file name. Now the block is unresolved. To fix that you can double-click the block and change the path to the library in the "Source block" field. After hitting OK the block will resolve and show up normally again.
How to do that programmatically? The issue is that I cannot change the "ReferenceBlock" property in case the block is unresolved. It only works when it´s resolved. So I can change from one existing library to another existing library only but not from a missing library to a valid one.
Background: I have several linked blocks in the model but need to change the library names frequently. So I would need to go through the model each time and change the links manually. Apart from that Matlab (2014b) always crashes nearly after the first change and completely after the second one. So my hope would also be that it would survive if the change is done from the command window.
Is there a solution for it?

답변 (1개)

Mandar Patwardhan
Mandar Patwardhan 2017년 6월 27일
To resolve library links programmatically, use the "SourceBlock" parameter instead of using the "ReferenceBlock" parameter.
  댓글 수: 1
Giuseppe Avallone
Giuseppe Avallone 2017년 7월 28일
Hello. I have the same problem. I tried this way, but it results "Reference block parameter 'SourceBlock' is read-only".

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Custom Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by