'Is it possible to use nested linked libraries in Simulink?

I am trying to set up a quite generic set of libraries to enhance my workspace and want to set up a nested set of library components. Each component lives in its own library file and collections of related components are collected into library files with each component a linked reference to the individual file. What I am trying to do is set up a root library file that recursively includes linked sub-libraries down to the individual components. The problem is if a library contains a linked subsystem that is itself a library, the Library Browser does not allow expanding the library into its sub-blocks with the '+' symbol.

Is it possible to create a library in this way and have Library Browser expand the linked sublibraries?



Solution 1:[1]

It does not seem you can use multiple levels of nesting in the way you describe, you may not actually need the intermediate libraries.

If you are only creating intermediate libraries to link the next level down, then they can just be replaced with a subsystem, keep nesting subsystems as needed until you get down to the lowest library level (in your case the library files with just single blocks in them), then reference those final library block files with a reference subsystem (i.e. linking them in the Open callback).

Simulink will nest the subsystems in the browser as many levels as you want to put, and then at the lowest level if you use the referenced subsystems to refer to the single block libraries, those will unnest and show the actual blocks at the lowest level.

So, you end up with just the top level libraries that have a bunch of nested subsystems, that create the hierarchy you want, with references to the individual block libraries at the bottom of the hierarchy.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1