This example illustrates how you can convert a package of Simscape™ component files into a custom block library, containing sublibraries with customized names and appearance. It summarizes the techniques described in Organizing Your Simscape Files, Converting Your Simscape Files, and Customizing the Library Name and Appearance.
Consider the following directory structure:
- +MySimscapeLibrary |-- +MechanicalElements | |-- lib.m | |-- lib.jpg | |-- inertia.ssc | |-- spring.ssc |-- +ElectricalElements | |-- ... |-- +HydraulicElements | |-- ...
This means that you have a top-level package called
+MySimscapeLibrary, which contains three subpackages,
package contains two component files,
spring.ssc, a library icon file
the following library configuration file
function lib ( libInfo ) libInfo.Name = 'Basic Mechanical Elements'; libInfo.Annotation = sprintf('This library contains basic mechanical elements'); libInfo.ShowName = true;
When you run
the top-level package generates a library model called
MySimscapeLibrary_lib, as follows:
Notice that the sublibrary generated from the
package is presented in its parent library with a customized icon and name
Basic Mechanical Elements).
If you double-click the Basic Mechanical Elements sublibrary, it opens as follows: