Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration - Add or provide encryption password for code generation
from protected model - MATLAB (original) (raw)
Main Content
Add or provide encryption password for code generation from protected model
Syntax
Description
Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration([model](#buikwfg-model),[password](#buikwfg-password))
adds an encryption password for code generation if you create a protected model. If you use a protected model, the function provides the required password to generate code from the model.
Examples
Create a protected model with encryption for code generation.
openExample('sldemo_mdlref_counter'); Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration(... 'sldemo_mdlref_counter','password'); Simulink.ModelReference.protect('sldemo_mdlref_counter',... 'Mode','CodeGeneration','Encrypt',true,'Report',true);
A protected model named sldemo_mdlref_counter.slxp
is created that requires an encryption password for code generation.
Use a protected model with encryption for code generation.
Provide the encryption password required for code generation from the protected model.
openExample('sldemo_mdlref_counter'); Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration(... 'sldemo_mdlref_counter','password');
After you have provided the encryption password, you can generate code from the protected model.
Input Arguments
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 code generation, the password is required.
Version History
Introduced in R2014b