MATLAB: How to create an array containing the system layout of a Simulink model

simulink hierarchy

Simulink has a model viewer which allows one to view all the levels of a Simulink model. I want to package that into an array in order to automate a report writing process. Does anyone know of a command in Matlab that will allow me to capture the Simulink model hierarchy in an array?

Best Answer

Hierarchy=find_system('ModelName','LookUndermasks','All','FollowLinks','on','BLockType','SubSystem')