Why do I get sublibs in simulink browser for my custom lib

6 views (last 30 days)
I have created a customized Simulink library. I followed the instructions outlined in the following link: https://se.mathworks.com/help/simulink/ug/adding-libraries-to-the-library-browser.html to ensure that the library appears correctly in the Simulink browser. However, I am encountering an issue where certain "sub-libraries" are appearing in the library browser that are not intended to be part of the library. These sub-libraries seem to correspond to the names of certain blocks within the actual library.
I have attached a screenshot below to illustrate how the library browser looks. The section highlighted in red actually represents blocks with the same names as those in the main library. Strangely, they are displayed as sub-libraries.
If I expand one of the "sublibs" it displays all parts that the actulal block consists but separatly:
I have tried restarting matlab and refreshing the lib but the problem still exist. Does any one have soution for this?
MATLAB Version: 9.13.0.2126072 (R2022b) Update 3
MATLAB License Number: 41069452
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 19044)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.13 (R2022b)
Simulink Version 10.6 (R2022b)
Simscape Version 5.4 (R2022b)
Simscape Fluids Version 3.5 (R2022b)
>>
Below follows the code for the code that shall make the lib to show in the browser
function blkStruct = slblocks
Browser.Name = 'SSG Library';
Browser.Library = 'ssg_simscape_lib';
blkStruct.Browser = Browser;

Answers (1)

Brahmadev
Brahmadev on 4 Sep 2023
Hi Magnus,
I understand that you are trying to create a Custom Library with your "Subsystem" blocks. However, as mentioned in the tutorial you have referred, simply using a "Subsystem" block in your Library will create a "Sublibrary" with all the blocks used inside the "Subsystem".
One way to ensure that your Custom blocks created using "Subsystem" block stay intact is using a "Variant Subsystem" block. You can either add your current block model inside a new "Variant Subsystem" or right-click on the subsystem block, click on "Subsystem & Model Reference", click on “Convert to” and choose “Variant Subsystem”. This should help you use your custom blocks in your custom library instead of creating Sublibraries.
Hope this helps!

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!