blocksimulinksubsystem

find_system returns objects that are not subsystems in simulink?


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.


Solution

  • 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'.