MATLAB 帮助中心
为受保护模型的仿真添加或提供加密密码
Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(model,password)
如果您创建一个受保护模型,Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(model,password) 会为仿真添加加密密码。如果您使用受保护模型,该函数会提供仿真模型所需的密码。
model
password
示例
全部折叠
创建一个为仿真加密的受保护模型。
openExample('sldemo_mdlref_counter'); Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(... 'sldemo_mdlref_counter','password'); Simulink.ModelReference.protect('sldemo_mdlref_counter',... 'Encrypt',true,'Report',true);
创建一个名为 sldemo_mdlref_counter.slxp 的受保护模型,该模型需要加密密码才能进行仿真。
sldemo_mdlref_counter.slxp
使用一个为仿真加密的受保护模型。
提供受保护模型仿真所需的加密密码。
openExample('sldemo_mdlref_counter'); Simulink.ModelReference.ProtectedModel.setPasswordForSimulation(... 'sldemo_mdlref_counter','password');
提供加密密码后,您就可以对受保护模型进行仿真。
模型名称,指定为字符串或字符向量。它包含模型的名称或引用受保护模型的 Model 模块的路径名称。
密码,指定为字符串或字符向量。如果受保护模型已为仿真加密,则需要密码。
在 R2014b 中推出
Simulink.ModelReference.protect | Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration | Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration (HDL Coder) | Simulink.ModelReference.ProtectedModel.setPasswordForView
Simulink.ModelReference.protect
Simulink.ModelReference.ProtectedModel.setPasswordForCodeGeneration
Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration
Simulink.ModelReference.ProtectedModel.setPasswordForView
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处