This example shows how to create a web app and host it on the development version of MATLAB® Web App Server . The example uses the simple calculator app from App Designer as a basis for the web app. For information about the app and the numerical values you can enter, see App that Calculates and Plots Data Based on Numerical Input. In the workflow, you:
Package the simple calculator app from App Designer using the Web App Compiler
app in MATLAB
Compiler™. This step creates a web app archive (.ctf
)
file.
Deploy the web app archive (.ctf
) file to the development version of MATLAB Web App Server.
Run the web app from the web apps home page.
Install and configure the development version of MATLAB Web App Server™.
For information on installing the server, see Install the Development Version of MATLAB Web App Server in MATLAB Compiler.
For information on configuring the server, see Configure the Development Version of MATLAB Web App Server in MATLAB Compiler.
Copy the App Designer file Mortgage.mlapp
to your
current working directory. The default location of the file is:
Operating System | Default File Location |
---|---|
Windows® | C:\Program Files\MATLAB\R2020b\examples\matlab\main\Mortgage.mlapp |
Linux® | /usr/local/MATLAB/R2020b/examples/matlab/main/Mortgage.mlapp |
macOS | /Applications/MATLAB/R2020b.app/examples/matlab/main/Mortgage.mlapp |
Start MATLAB.
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 the
Mortgage.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) Make sure to use a display name that is easy to distinguish when your web app is deployed to the server.
(Optional) Provide a version number for tracking purposes. The version number is visible on the web apps home page.
(Optional) Add a description for your web app in the Summary field. This description is visible on the web apps home page.
In the Archive information section, specify the
archive name as myMortgageWebApp
.
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 opens the project folder, which contains the following files:
myMortgageWebApp.ctf
mccExcludedFiles.log
PackagingLog.html
requiredMCRProducts.txt
You can view the log file, PackagingLog.html
, to see
the exact mcc
syntax used to package and create the web
app archive.
Navigate to the project folder generated by Web App Compiler during the packaging process.
Copy the web app archive file myMortgageWebApp.ctf
to
the app folder configured by the server. The default location is:
Operating System | Apps Folder Location |
---|---|
Windows |
|
Linux |
|
macOS |
|
You can also open the apps folder by clicking the Open App Folder button in the server application. For more information, see Start the Server Application.
Click the Open Home Page button in the server application.
This action opens the web apps home page using your default web browser. You see a tile displaying the simple mortgage calculator web app. Your web app is now deployed.
To run a web app, click the myMortgageWebApp
tile on the
web apps home page.
The web app opens in a new tab.
Click the Monthly Payment button to get the monthly payment and the principal and interest graph.
You have successfully created, deployed, and run a web app.
Mortgage Calculator Web App