Create Web App
To create a web app, you must first use MATLAB® App Designer to design the app, and then package it using Web App
Compiler app or the compiler.build.webAppArchive
function.
App Designer Prerequisite
Before you can package and then deploy a web app, you need to create an app using MATLAB App Designer. For more information, see Create and Run a Simple App Using App Designer.
Create a Web App Using Web App Compiler App
Type
webAppCompiler
at the MATLAB command line to open the Web App Compiler app.In the MAIN FILE section of the toolstrip, click the button to add your App Designer
.mlapp
file to the project. The Web App Compiler automatically resizes to include an App details section that contains information about the app such as app name, author, summary, description, and version. You can edit information about the app in App Designer by clicking Edit App Details. Click Refresh to update Web App Compiler with any changes you have made.(Optional) Select Copy web app to server app folder check box and specify the path to the app folder on the server where you want the web app archive (
.ctf
file) to be automatically copied. If you leave this check box cleared, the Web App Compiler will create the web app archive (.ctf
file) in the project folder. You must manually copy or upload the web app archive (.ctf
file) to the app folder on the server. For more information, see Configure the Development Version of MATLAB Web App Server in MATLAB Compiler.Add supporting files, if any, in the Files required for your app to run section. Supporting files include any MAT-files, images used by your web app, or user-written MATLAB functions not found by MATLAB Compiler™.
Click Package to package the app, and create a web app archive (
.ctf
file).In the Save Project dialog box that opens, specify a project name and a location where you want to save the web app project. Web App Compiler saves your project and opens a Package dialog box.
Once packaging is complete, in the Package dialog box, click Open output folder. This step opens the project folder which contains the following files:
webAppArchiveName
.ctfmccExcludedFiles.log
PackagingLog.html
requiredMCRProducts.txt
You can view the log file,
PackagingLog.html
, to see the exactmcc
syntax used to package and create the web app archive.To use the web app, deploy the web app archive file,
. For more information, see Deploy Web App.webAppArchiveName
.ctf
Create a Web App Using compiler.build.webAppArchive
Function
Use the compiler.build.webAppArchive
function in MATLAB
Compiler to package your web app by specifying the application file, archive name,
and output directory. This method allows for precise control over the naming and storage
location of your web app. For
example:
compiler.build.webAppArchive("Mortgage.mlapp",... 'ArchiveName','MyMortgageWebApp',... 'OutputDir','D:\Documents\MATLAB\work\WebApps')
Compatibility Considerations
In most cases, you can generate a web app archive (.ctf
file) on
one platform and deploy to a server running on any other supported platform. Unless you
add operating system-specific dependencies or content, such as MEX files or Simulink® simulations to your applications, the generated archives are
platform-independent.
See Also
compiler.build.webAppArchive
| compiler.build.WebAppArchiveOptions