Main Content

Simulink.ModelReference.ProtectedModel.setPasswordForModify

Add or provide password for modifying protected model

Description

example

Simulink.ModelReference.ProtectedModel.setPasswordForModify(model,password) adds a password for a modifiable protected model. After the password has been created, the function provides the password for modifying the protected model.

Examples

collapse all

Create a modifiable protected model with support for code generation, then modify it to add Web view support.

Add the password for when a protected model is modified. If you skip this step, you are prompted to set a password when a modifiable protected model is created.

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

Create a modifiable protected model with support for code generation and Web view.

Simulink.ModelReference.protect('sldemo_mdlref_counter','Mode',...
'CodeGeneration', 'Modifiable',true, 'Report',true);

Provide the password to modify the protected model.

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

Add support for Web view to the protected model that you created.

Simulink.ModelReference.modifyProtectedModel(...
'sldemo_mdlref_counter','Mode','CodeGeneration','Webview',true,...
'Report',true);

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 to be modified.

Password, specified as a string or character vector. The password is required for modification of the protected model.

Introduced in R2014b