Main Content

ssc_protect

(To be removed) Generate Simscape protected files from source files

ssc_protect will be removed in a future release. Use sscprotect instead. (since R2024b) Syntax and arguments of the two functions are identical.

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 folder. filename can include absolute path to the file, or relative path if the file is in a subfolder of the current working folder. If this path includes namespace folders, the namespace structure will be recreated under the current working folder (unless it already exists) and the protected file placed in the namespace (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 folder as the source file.

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

ssc_protect dirname -inplace generates Simscape protected files from all the Simscape source files in the folder named dirname, and places the protected files in the same folder 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 folder, 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 folder, 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 folder (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 folder 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 folder, with the protected files placed under your current working folder, 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 folder (creating this folder structure, if it does not exist).

To protect all files in a folder, with the protected files placed in the same folder 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

expand all

See Also