Main Content

Customizing the Library Name and Appearance

Library Configuration Files

Namespace names must be valid MATLAB® identifiers. The top-level namespace always generates a library model with the name namespace_name_lib. However, library configuration files let you provide descriptive library names and specify other customizations for sublibraries, generated from subfolders in the namespace hierarchy.

A library configuration file must be located in the namespace folder and named lib.m.

Library configuration files are not required. You can choose to provide lib.m for some subnamespaces, all subnamespaces, or for none of the subnamespaces. If a subnamespace does not contain a lib.m file, the sublibrary is built using the default values. The top-level namespace can also contain a lib.m file. Options such as library name, and other options that do not make sense for a top-level library, are ignored during build. However, having a file with the same name and options in the top-level namespace provides a uniform mechanism that lets you easily change the library hierarchy.

The following table describes the supported options. The only option that is required in a lib.m file is Name; others are optional.

OptionUsageDescriptionDefaultFor Top-Level Namespace
NamelibInfo.Name = namename will be used as the name of the sublibrary (name of the Simulink® subsystem corresponding to the sublibrary) Namespace nameIgnored
AnnotationlibInfo.Annotation = annotationannotation will be displayed as annotation when you open the sublibrary. It can be any text that you want to display in the sublibrary.No annotation in the libraryUsed in annotation for top-level library
ShowIconlibInfo.ShowIcon = falseIf there is no library icon file lib.img, as described in Customizing the Library Icon, this option is ignored. If there is an icon file, you can choose to not use it by setting this option to false. trueIgnored
ShowNamelibInfo.ShowName = trueAllows you to configure whether the sublibrary name is shown in the parent library. If there is no library icon file, then the default library icon contains the library name, and showing it again is redundant. If you are using a library icon file, set showName to true to display the library name below the icon.falseIgnored
HiddenlibInfo.Hidden = trueAllows you to configure whether the sublibrary is visible in the parent library. Use this option for a sublibrary containing blocks that you do not want to expose, for example, those kept for compatibility reasons.falseIgnored

Customizing the Library Icon

If a subnamespace contains a file named lib.img, where img is one of the supported image file formats (such as jpg , bmp, or png), then that image file is used for the icon representing this sublibrary in the parent library. The icon file (lib.img) and customization file (lib.m) are independent, you can provide one or the other, both, or none.

The following image file formats are supported:

  • jpg

  • bmp

  • png

If there are multiple image files, the formats take precedence in the order listed above. For example, if a subnamespace contains both lib.jpg and lib.bmp, lib.jpg is the image that will appear in the parent library.

You can turn off customizing the library icon by setting showIcon to false in the library customization file lib.m. In this case, the default library icon will be used. For more information, see Library Configuration Files.

Related Examples

More About