| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
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)
Simulink.ModelReference.protect(model) creates a protected model from model and puts it 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 in neededVars a cell array that 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. See Protecting Referenced Models for more information.
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. |
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. |
![]() | Simulink.Bus.save | Simulink.SubSystem.convertToModelReference | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |