Reputation: 15
I am trying to find all the SubSystems present in a Simulink model at a particular Level including the Subsystems from Third Party libraries. However, in the result I get some values instead of names of the SubSystems from Libraries.
Instruction Used:
find_system('Level1/Level2','SearchDepth',1,'LookUnderMasks','on','BlockType','SubSystem')
Result:
'Level1/Subsystem1'
'Level1/SubSystem2'
[1x11 char]
[1x90 char]
[1x34 char]
Upvotes: 0
Views: 9302
Reputation: 13876
It's because find_system
returns a cell array or vector of handles, see the documentation:
If
sys
is a pathname or cell array of pathnames,find_system
returns a cell array of pathnames of the objects it finds. Ifsys
is a handle or a vector of handles,find_system
returns a vector of handles to the objects that it finds. Ifsys
is omitted,find_system
searches all loaded systems and returns a cell array of pathnames.
Use an output argument when calling the function and you'll be able to explore the contents of the returned variable, e.g.:
my_sys = find_system('Level1/Level2','SearchDepth',1,'LookUnderMasks','on','BlockType','SubSystem');
Then you should be able to see what's in my_sys
and access its contents.
Upvotes: 3
Reputation: 36710
The find_system
method returns handles to simulink blocks. To get the name of the subsystem you have to use the getfullname
function to get the names for the handles.
Upvotes: 2