Main Content

Simulink.ModelReference.ProtectedModel.setPasswordForView

Add or provide encryption password for read-only view of protected model

Description

example

Simulink.ModelReference.ProtectedModel.setPasswordForView(model,password) adds an encryption password for read-only view if you create a protected model. If you use a protected model, the function provides the required password for a read-only view of the model.

Examples

collapse all

Create a protected model with encryption for read-only view.

Simulink.ModelReference.ProtectedModel.setPasswordForView(...
'sldemo_mdlref_counter','password');
Simulink.ModelReference.protect('sldemo_mdlref_counter',...
'Webview',true,'Encrypt',true,'Report',true);

A protected model named sldemo_mdlref_counter.slxp is created that requires an encryption password for read-only view.

Use a protected model with encryption for read-only view.

Provide the encryption password required for the read-only view of the protected model.

Simulink.ModelReference.ProtectedModel.setPasswordForView(...
'sldemo_mdlref_counter','password');

After you have provided the encryption password, you have access to the read-only view of 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 read-only view, the password is required.

Introduced in R2014b