When I use find_system(gcs,'BlockType','SubSystem') it returns things that are not subsystems (AFAIK)

In my case the things that are called

subsys L1 -x

and

SubsysX L2 - z

are subsystems, but the names are just for debugging purpose, so I can't use the names to match.

Why is [1x51 char] and Sine and RealisesUID appearing?

I only want the subsystems showing up in the Model Browser tree.

'test_simulinkmodel/RealisesUID'
'test_simulinkmodel/subsys L1 - 1'
[1x51 char]
'test_simulinkmodel/subsys L1 - 1/Sine'
'test_simulinkmodel/subsys L1 - 1/Subsys1 L2 - 1'
[1x71 char]
[1x68 char]
'test_simulinkmodel/subsys L1 - 2'
[1x51 char]
'test_simulinkmodel/subsys L1 - 2/Sine'
'test_simulinkmodel/subsys L1 - 2/Subsys2 L2 - 1'
[1x71 char]
[1x68 char]
'test_simulinkmodel/subsys L1 - 3'
[1x51 char]
'test_simulinkmodel/subsys L1 - 3/Sine'
'test_simulinkmodel/subsys L1 - 3/Subsys3 L2 - 1'
[1x71 char]
[1x68 char]

EDIT: They show up in the model browswer if i select include library links and include systems with mask parameters. However, the default of find_system is 'FollowLinks' 'off' and 'LookUnderMasks' doesn't say. However, even if i provide explicit off and none, they still return the same result.

有帮助吗?

解决方案

You can add LinkStatus parameter to find_system to look for only your own sub-systems and not the ones from libraries. find_system(gcs,'BlockType','SubSystem','LinkStatus','none'). The same way you can also add 'Mask' with 'on' or 'off' values to filter based on whether the block has a mask on it.

Is "Sine" a sub-system from your own library? Sine wave block from Simulink library would not show up if you search for 'BlockType' of 'SubSystem'.

其他提示

I suspect the Sine block is a subsystem if you were to look under the mask, you would probably find an S-function. You can maybe specify a 'SearchDepth' argument to find_system or set 'LookUnderMasks' to 'none' (assuming your actual subsystems subsys L1 -x and SubsysX L2 - z aren't masked).

http://www.mathworks.co.uk/help/simulink/slref/find_system.html

You seem to get all subsystems within subsystems as a result. As suggested by am304 you can limit the search by using SearchDepthoption, but I usually find it easier to use Parent to limit the level of search. In your case

find_system(gcs,'Parent', 'test_simulinkmodel', 'BlockType', 'SubSystem');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top