Main Content

Simulink.ModelReference.ProtectedModel.setPasswordForSimulation

Add or provide encryption password for simulation of protected model

Description

Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(model,password) adds an encryption password for simulation if you create a protected model. If you use a protected model, the function provides the required password to simulate the model.

example

Examples

collapse all

Create a protected model with encryption for simulation.

openExample('sldemo_mdlref_counter');
Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(...
'sldemo_mdlref_counter','password');
Simulink.ModelReference.protect('sldemo_mdlref_counter',...
'Encrypt',true,'Report',true);

A protected model named sldemo_mdlref_counter.slxp is created that requires an encryption password for simulation.

Use a protected model with encryption for simulation.

Provide the encryption password required for simulation of the protected model.

openExample('sldemo_mdlref_counter');
Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(...
'sldemo_mdlref_counter','password');

After you have provided the encryption password, you can simulate the protected model.

Input Arguments

collapse all

Model name, specified as a string or character vector. It contains the name of a model or the path name of a Model block that references the protected model.

Password, specified as a string or character vector. If the protected model is encrypted for simulation, the password is required.

Version History

Introduced in R2014b