Main Content

金宝app模拟Web应用程序

此示例显示如何创建包含Simulink的Web应用程序金宝app®模拟并主持它马铃薯草®Web App Server™。该示例使用Simulink中的Mass Spring Damper模型和Matlab应用程序调用模金宝app型作为Web应用程序的基础。可以在创建模拟中找到用于创建模拟的API金宝appSimulink Compiler™产品。在工作流程中,您:

  • 打包包含Simulink仿真的MATLAB应用程序使用Web App金宝app Compiler应用程序Matlab编译器。This step creates a web app archive (.ctf.) 文件。

  • 部署Web应用程序存档(.ctf.)文件到MATLAB Web App Server

  • 从Web Apps主页运行Web应用程序。

先决条件

笔记

这个例子需要金宝appSimulink编译器产品。有关详细信息,请参阅金宝appSimulink编译器工作流程概述(金宝appSimulink编译器)

  1. 安装MATLAB Web App Server产品并设置服务器。

  2. 复制Simulin金宝appk模型文件massspringdampermodel.slx.和相应的matlab应用程序MassSpringDamperApp.mlappto your current working directory. The default location for the files is:

    操作系统 Default Location for Files
    Windows® C:\ Program Files \ Matlab \R2022A\示例\ simul金宝appinkcompiler \ main \
    Linux.® / usr / local / matlab /R2022A/示例/ simul金宝appinkcompiler / main
    苹果系统 /应用程序/ MATLAB /R2022A.app / example金宝apps / simulinkcompiler / main
  3. 打开MassSpringDamperApp.mlapp在Matlab应用程序设计师和切换到代码视图。验证这一点金宝appSimulink编译器创建模拟的API存在于此simulateButtonpushed.打回来。

包并创建Web应用程序

  1. Start MATLAB.

  2. 类型webAppCompilerat the MATLAB command line to open theWeb App编译器应用程序。

  3. In the主文件ToolStrip的一部分,单击button to add theMassSpringDamperApp.mlappfile to the project. The Web App Compiler automatically resizes to include an应用程序详细信息包含有关应用程序的信息的部分,如应用名称,作者,摘要,描述和版本。您可以单击编辑有关App Designer中的应用程序的信息Edit App Details。点击刷新更新Web App Compiler与您所做的任何更改。

    • (可选的)确保使用易于区分的显示名称,当您的Web应用程序部署到服务器时。

    • (可选的)Provide a version number for tracking purposes. The version number is visible on the web apps home page.

    • (可选的)Add a description for your web app in theSummaryfield. This description is visible on the web apps home page.

  4. In the归档信息部分,指定存档名称为my金宝appsimulinksimulationwebapp.

  5. 点击包裹要打包应用程序,并创建Web应用程序存档(.ctf.file).

    In the保存项目将打开的对话框,指定项目名称以及要保存Web App项目的位置。Web App编译器saves your project and opens a包裹对话框。

  6. 一旦包装完成,就在包裹dialog box, click打开输出文件夹。这将打开项目文件夹,其中包含以下文件:

    • my金宝appsimulinksimulationwebapp.ctf.

    • mccexcludedfiles.log.

    • PackagingLog.html

    • RequessMcrP下载188bet金宝搏roducts.txt.

    您可以查看日志文件,PackagingLog.html,看精确世纪挑战集团syntax used to package and create the web app archive.

Deploy Web App

  1. 在打包过程中导航到Web App Compiler生成的项目文件夹。

  2. 复制Web应用程序存档文件my金宝appsimulinksimulationwebapp.ctf.到服务器配置的应用程序文件夹。默认位置是:

    操作系统 Apps文件夹位置

    Windows

    %programdata%\ mathworks \ webapps \R2022A\apps

    Linux.

    /local/MathWorks/webapps/R2022A/apps

    苹果系统

    /Library/Application Support/MathWorks/webapps/R2022A/apps

    您还可以通过执行来获取Apps文件夹的位置webapps状态在System命令shell。

  3. Open a web browser and navigate to the web apps home page using the URL obtained from executing thewebapps状态命令。您看到一个显示简单抵押计算器Web应用程序的瓷砖。您的Web应用程序现已部署。

运行Web App.

  1. 要运行Web应用程序,请单击my金宝appsimulinksimulationwebapp.在Web Apps主页上的图块。

    Web应用程序将在新选项卡中打开。

  2. 点击模拟按钮以运行模拟。

    您已成功创建,部署和运行Web应用程序。

Related Topics