Main Content

sscmirror

Create protected mirror of library of Simscape files

Since R2024b

Description

sscmirror(namespace,mirrordir) creates a protected mirror of a namespace of Simscape™ files, namespace, in the specified folder, mirrordir.

example

sscmirror(namespace,mirrordir,true) lets you protect and build a whole namespace of Simscape files in one step. It creates a protected mirror of a namespace of Simscape files, namespace, in the specified folder, mirrordir, and also builds a custom library from these files in the mirrordir folder. The custom Simscape library file is named namespace_lib. The buildmirror flag is optional and the default is false, that is, by default the namespace is mirrored and protected but the library is not built.

example

sscmirror namespace mirrordir true is the command form of the syntax. Command form requires fewer special characters. You do not need to type parentheses or enclose the input in single or double quotes. Separate inputs with spaces instead of commas.

Do not use command form when mirrordir uses variables, or functions like fullfile, to specify the output library name and location. For more information on the command-function duality, see Choose Command Syntax or Function Syntax.

example

Examples

collapse all

Suppose your top-level namespace folder, where you store your Simscape files, is named +SimscapeCustomBlocks and is located in C:\Work\MyLibraries. You want to create a protected mirror of this namespace and generate a custom block library in the folder C:\Work\deploy.

Change your current working folder to C:\Work\MyLibraries. Then, at the MATLAB® Command prompt, type:

sscmirror('SimscapeCustomBlocks','C:\Work\deploy',true)

You can also use the command form of this syntax, which requires fewer special characters:

sscmirror SimscapeCustomBlocks C:\Work\deploy true
Mirroring 'SimscapeCustomBlocks' in to directory 'C:\Work\deploy' ... 
... mirror complete.
Generating Simulink library 'SimscapeCustomBlocks_lib' in the current directory 'C:\Work\deploy' ...

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

Suppose your top-level namespace folder, where you store your Simscape files, is named +SimscapeCustomBlocks and is located in C:\Work\MyLibraries.

To create a protected mirror of this namespace without generating a custom block library, change your current working folder to C:\Work\MyLibraries. Then, at the MATLAB Command prompt, type:

sscmirror('SimscapeCustomBlocks','C:\Work\deploy')

You can also use the command form of this syntax, which requires fewer special characters:

sscmirror SimscapeCustomBlocks C:\Work\deploy
Mirroring 'SimscapeCustomBlocks' in to directory 'C:\Work\deploy' ... 
... mirror complete.

This command creates a mirror namespace, equivalent to the +SimscapeCustomBlocks namespace but consisting of Simscape protected files, in the folder C:\Work\deploy, but does not generate a custom library from these files.

Input Arguments

collapse all

Name of namespace containing Simscape files, specified as a character vector or a string scalar and located in the folder from which you call the sscbuild function. namespace is the name of the top-level namespace folder without the leading + character. When you call sscmirror using the command syntax, do not use quotes around namespace. For more information on the command-function duality, see Choose Command Syntax or Function Syntax.

Example: sscmirror MyNamespace is the command syntax to build a library from the namespace +MyNamespace. The equivalent function syntax is sscmirror('MyNamespace').

Full path and name of the folder to contain the mirror namespace and block library, specified as a character vector or a string scalar. If the folder does not exist, sscmirror creates it.

When you call sscmirror using the function syntax, you can also use MATLAB variables and functions, such as fullfile or genpath, to specify the path to the folder.

Example: fullfile(tempdir,'MyLibrary.slx') with function syntax, you can use MATLAB variables and functions to specify the path.

Version History

Introduced in R2024b