Main Content


Create protected mirror of library of Simscape files


ssc_mirror package mirrordir buildmirror


The ssc_mirror command lets you protect and build a whole package of Simscape™ files in one step.

ssc_mirror package mirrordir buildmirror creates a protected mirror of a package of Simscape files in a specified directory mirrordir, and also optionally builds a custom library from these files.

The first argument, package, must be a top-level package name.


The package directory name begins with a leading + character, whereas the argument to ssc_mirror must omit the + character.

The second argument, mirrordir, is the directory where the protected package is placed. The ssc_mirror command creates this directory, if it does not exist, recreates the whole package structure under it, generates the protected files, and places them in the appropriate mirror locations.

If the buildmirror flag is set to true, the ssc_mirror command also builds a custom Simscape library file, named package_lib, containing all the sublibraries and blocks generated from the Simscape files in the mirrored package (similar to the ssc_build command), and places the package_lib file in the mirrordir directory. The buildmirror flag is optional and the default is false, that is, by default the package is mirrored and protected but the library is not built.

For more information, see Using Source Protection for Simscape Files.


For example, your top-level package directory, where you store your Simscape files, is named +SimscapeCustomBlocks. To protect, mirror, and generate a custom block library from this package in the directory C:\Work\deploy, at the MATLAB® Command prompt, type:

ssc_mirror SimscapeCustomBlocks C:\Work\deploy true;

This command creates a mirror package, equivalent to the +SimscapeCustomBlocks package but consisting of Simscape protected files, in the directory C:\Work\deploy, and generates a file called SimscapeCustomBlocks_lib in the C:\Work\deploy directory.

Version History

Introduced in R2009a