0

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.

Viktor Mellgren
  • 4,318
  • 3
  • 42
  • 75

3 Answers3

2

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

Navan
  • 4,407
  • 1
  • 24
  • 26
  • Thank you, LinkStatus does not show up in the documentation for find_system, where did you find it? I'm not sure about Sine, seems to be a Function Block. I'm no simulink developer so I'm not that familiar with any terminology. – Viktor Mellgren Jul 03 '13 at 13:14
  • RealisesUID still show up, but it seems like its some a subsystem with a openFcn with a link, hopefully I will manage anyway. – Viktor Mellgren Jul 03 '13 at 13:17
  • For 'p*','v*' values mentioned in the doc for find_system you can specify any of the block parameters. The table in the doc lists only constraints ('c*' values). – Navan Jul 03 '13 at 13:50
0

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

am304
  • 13,758
  • 2
  • 22
  • 40
0

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');
Mohsen Nosratinia
  • 9,844
  • 1
  • 27
  • 52
  • I want all subsystems, but not the ones which show up when i select ``include library links`` and ``include systems with mask parameters.`` The problem is that those limitations using parameters does not seem to work – Viktor Mellgren Jul 03 '13 at 12:47