Main Content

ssc_protect

Generate Simscape protected files from source files

Syntax

ssc_protect filename
ssc_protect filename -inplace
ssc_protect dirname
ssc_protect dirname -inplace

Description

The ssc_protect command creates content-obscured files (Simscape™ protected files) from Simscape source files, to enable model sharing without disclosing the component or domain source. While Simscape source files have the extension .ssc, Simscape protected files have the extension .sscp.

ssc_protect filename generates a Simscape protected file, named filename.sscp, from the Simscape source file named filename.ssc, and places the protected file in your current working directory. filename can include absolute path to the file, or relative path if the file is in a subfolder of the current working directory. If this path includes package directories, the package structure will be recreated under the current working directory (unless it already exists) and the protected file placed in the package (see examples). The extension .ssc in filename is optional.

ssc_protect filename -inplace generates a Simscape protected file, named filename.sscp, from the Simscape source file named filename.ssc, and places the protected file in the same directory as the source file.

ssc_protect dirname generates Simscape protected files from all the Simscape source files in the directory named dirname, and places the protected files under your current working directory. If the path to dirname includes package directories, the package structure will be recreated under the current working directory (unless it already exists) and the protected files placed in the package, similar to when protecting a single file.

ssc_protect dirname -inplace generates Simscape protected files from all the Simscape source files in the directory named dirname, and places the protected files in the same directory as the source files.

Note

Existing Simscape protected files are overwritten without warning.

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

Simscape protected files have higher precedence than the source files when you build a library. If the protected and the source files are in the same directory, and protected files are out of date, ssc_build will use the protected files to build the library, but you will get a warning.

Examples

To protect a single file, with the protected file placed under your current working directory, at the MATLAB® Command prompt, type:

ssc_protect C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements\my_spring.ssc

This command creates a folder called +SimscapeLibrary and a subfolder called +MechanicalElements in your current working directory (unless these folders already exist) and generates a file called my_spring.sscp in the +MechanicalElements folder.

To protect a single file, with the protected file placed in the same directory as the source file, type:

ssc_protect C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements\my_spring.ssc -inplace

This command generates a file called my_spring.sscp in the C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements folder.

To protect all files in a directory, with the protected files placed under your current working directory, type:

ssc_protect C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements

This command generates protected files for each source file in the C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements folder, and places the protected files in a folder called +SimscapeLibrary\+MechanicalElements in your current working directory (creating this folder structure, if it does not exist).

To protect all files in a directory, with the protected files placed in the same directory as the source files, type:

ssc_protect C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements -inplace

This command generates protected files for each source file in the C:\Work\libraries\source\+SimscapeLibrary\+MechanicalElements folder, and places the protected files in the same folder.

Version History

Introduced in R2009a