Search for all the Divide block in a subsystem and its children
2 次查看(过去 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 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!