Search for all the Divide block in a subsystem and its children
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I am trying to find for all the Divide blocks in a model subsystem (and its children) but with no success. Here is the code that I use
Global_path = 'MyModel/MySubsystem';
blks = find_system(Global_path,'BlockType','Divide');
but with no success. On the other hand, as I think that Divide block is basically a Product block, I use this syntax instead:
Global_path = 'MyModel/MySubsystem';
blks = find_system(Global_path,'BlockType','Product','Inputs', '*/');
The latter code seems to work a bit better. However, I have two questions:
1. Are we sure that I am searching only in 'MyModel/MySubsystem'? I DON'T want to search in any other submodel, i.e. 'MyModel/AnotherSubsystem' shall be exluded
2. This method is not very robust as it search only blocks that has exactly '*/' as input. If I have a block that instead would have '**/' will be excluded. How can I robustify my code? For example by searching for all the blocks that CONTAIN the string '/'?
Many thanks!
댓글 수: 0
답변 (1개)
Sharan Paramasivam Murugesan
2017년 8월 22일
1. Yes, find_system function will search only under the system you specify.
2. Use the option "RegExp" with value "on" i.e., blks = find_system(Global_path,'RegExp','on','BlockType','Product','Inputs','/')
댓글 수: 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!