在此示例中,您准备了一个模型以与万博1manbetx®编译器™,开发和编译脚本,然后将其部署为独立应用程序。
万博1manbetxSimulink编译器使用快速加速器仿真目标来生成可执行的可执行文件以提交Simulink模型。万博1manbetx万博1manbetxSimulink编译器仅支持可以万博1manbetx在快速加速器模式下运行的模型。要将模型的仿真模式设置为快速加速器,请使用模型参数'simulationmode'
和仿真input
目的。To enable simulation deployment of the model, your model must be supported by the Rapid Accelerator mode correctly.
万博1manbetxSimulink编译器只支持万博1manbetxSIM
功能语法万博1manbetxSimulink.SimulationInput
对象并返回万博1manbetxsimulink.simulationOutput
目的。
如果模型中存在回调,则在应用程序的构建时间中调用它们。但是,一旦部署了应用程序或脚本,这些回调就不会调用。
准备模型后,编写要部署的脚本。在此示例中,我们使用模型并更改脚本中的可调参数之一。
在matlab中®艾德itor, create a functiondeployedScript
。在此功能中,创建一个万博1manbetxSimulink.SimulationInput
模型的对象sldemo_suspn_3dof
并改变价值MB
与setVaria
方法的方法万博1manbetxSimulink.SimulationInput
目的。为确保模型以快速加速器模式运行,请设置仿真模式
至迅速的
through thesetModelParameter
方法的方法万博1manbetxSimulink.SimulationInput
对象或使用万博1manbetxsimulink.compiler.configurefordeployment
功能如下所示。
模拟中修改的变量可以在基本工作区或顶部模型工作区中。
功能deployedscript()in = s万博1manbetximulink.simulationInput('sldemo_suspn_3dof');in = in.setVariable('MB',1000);in = 万博1manbetxsimulink.simulatio.configurefordeployment(in);out = sim(in);结尾
将功能保存为一个deployedScript.m
。
Before compiling the script that you want to deploy, ensure that the files for the model and script, in this casesldemo_suspn_3dof
和deployedScript.m
,包含在MATLAB搜索路径上。要编译脚本,请使用MCC
command with the script name. To learn more about theMCC
命令,请参阅MCC
。
MCC-m deployedScript.m
万博1manbetxSimulink编译器自动将依赖项和部署脚本中的依赖项打包。如果命令MCC
找不到依赖性,您可能会看到错误。
如果您看到错误“无法解析名称万博1manbetxSimulink.SimulationInput
”,检查模型是否在路径上。
如果因文件位于另一个目录中,请使用标志将其连接-a
。例如,MCC -M scriptName.m -a mydatafile.dat
。
要运行已部署的可执行文件,您需要适当的运行时环境。安装MATLAB运行时, 看//www.tianjin-qmedu.com/s manbetx 845products/compiler/matlab-runtime.html。
您只能在开发部署应用程序的平台上运行已部署的应用程序。
从Windows命令提示符运行已部署的应用程序。从命令提示符中运行已部署的应用程序使应用程序可以在遇到错误时在命令提示符中打印诊断消息。这些消息可以是解决问题的有用工具。
万博1manbetxSimulink.SimulationInput
|configurefordeployment
|部署
|MCC
|SIM