Skip to Main Content Skip to Search
Product Documentation

Simulink.ModelReference.protect - Obscure referenced model contents to hide intellectual property

Syntax

Simulink.ModelReference.protect('model')
Simulink.ModelReference.protect('model', 'Path', pathname)
[harnessHandle] = Simulink.ModelReference.protect('model', 'Harness', true)
[~ ,neededVars] = Simulink.ModelReference.protect('model')
[harnessHandle,neededVars] = Simulink.ModelReference.protect('model', 'Path', pathname, 'Harness', true)

Description

Simulink.ModelReference.protect('model') creates a protected model from model and puts that protected model in the current folder. The protected model has the same name as the source model, and the suffix .mdlp.

Simulink.ModelReference.protect('model', 'Path', pathname) puts the protected model in the folder specified by pathname.

[harnessHandle] = Simulink.ModelReference.protect('model', 'Harness', true) creates a harness model for the protected model and returns the handle of the harnessed model in harnessHandle.

[~ ,neededVars] = Simulink.ModelReference.protect('model') returns a cell array. The cell array includes the names of all base workspace entities that the protected model might need in order to execute.

[harnessHandle,neededVars] = Simulink.ModelReference.protect('model', 'Path', pathname, 'Harness', true) combines the effect of all the preceding syntaxes into a single call.

Input Arguments

model

The name of the model to be protected, or the path name of a Model block that references the model to be protected.

'Path', pathname

Specifies that the protected version of the model should be placed in the folder named pathname. Omitting the keyword-value pair places the protected model in the current directory.

'Harness', true

Specifies that the function will create a harness model and return its handle in harnessHandle. Specifying false or omitting the keyword-value pair suppresses creation of a harness model.

Output Arguments

harnessHandle

The handle of the harness model created when the input arguments include 'Harness', true, or 0 otherwise. You can specify ~ instead of a name if you don't need a harness model but want to obtain the value of the second argument.

neededVars

A cell array that includes the names of all base workspace entities that the protected model might need in order to execute. The function always creates the cell array (though it may be empty) but the array is discarded unless captured by neededVars. The array may also include the names of some variables that the model does not need.

Examples

Create a protected model for the sldemo_mdlref_counter_bus model, specifying the name of the model.

sldemo_mdlref_bus
Simulink.ModelReference.protect('sldemo_mdlref_counter_bus')

Create a protected model for sldemo_mdlref_counter_bus model, specifying the full path to a Model block that references the sldemo_mdlref_counter_bus model.

sldemo_mdlref_bus
Simulink.ModelReference.protect('sldemo_mdlref_bus/CounterA')

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS