unable to programmatically find lines inside a custom library-block

조회 수: 5 (최근 30일)
Manuel K
Manuel K . 2022년 11월 28일
댓글: Fangjun Jiang . 2022년 11월 30일
I'm currently working on getting my subsystem to work as part of a library. This subsystem has a mask and modifys itsself: upon request old blocks and lines are deleted and new ones are placed. This works fine as long as I use it as a non-library block or I strip the part which connects the blocks. Somehow the command does not work inside a library block and therefore I get errors when the blocks should get connected to already existing lines (e.g. an already connected output-port can't take another signal).
I'm using the following command to search for all lines inside the library-block:
oldLines = find_system(gcb, 'FindAll', 'on', 'LookUnderMasks','all', 'type', 'line')
Since modifying the contents of a library-block only works inisde the initialization-function, I added a flag-parameter which allows me to update the contents only on request instead of all the events that trigger the function.
Is this behavior intended or is there another way to do this?
  댓글 수: 1
Manuel K
Manuel K 2022년 11월 29일
편집: Manuel K 님. 2022년 11월 30일
I can however find the
of the blocks and delete them, so the block can get its new connection. But this only disconnects the lines which results in them piling up inside the library-block. Eventually this fails too, maybe because the unconnected signals auto-connect again or whatever.
Since the command
also does not work (it does nothing inside a library-block), it's becoming quite a mess.

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 11월 30일
편집: Fangjun Jiang 님. 2022년 11월 30일
You forgot 'FollowLinks','On'
>> oldLines = find_system(gcb, 'FindAll', 'on', 'LookUnderMasks','all', 'type', 'line')
oldLines =
0×1 empty double column vector
>> oldLines = find_system(gcb, 'FindAll', 'on', 'FollowLinks','On','LookUnderMasks','all', 'type', 'line')
oldLines =
1.0e+03 *
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2022년 11월 30일
It's not clear to me what the issue is. Please ask a separate question.

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

추가 답변 (0개)


Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by