Simple Mortgage Calculator Web App

This example shows how to create a simple mortgage amortization calculator web app. The example uses the simple calculator app from App Designer as a starting point. For information about the app and the numerical values you can enter, see App that Calculates and Plots Data Based on Numerical Input (MATLAB). In the workflow, you:

  • Package the simple calculator app from App Designer using the Web App Compiler. This creates a web app archive (.ctf) file.

  • Deploy the web app by copying the web app archive (.ctf) file to the apps folder in the MATLAB® Web App Server.

  • Run the web app from the web apps home page.


  1. Install and configure the MATLAB Web App Server.

  2. Copy the App Designer file Mortgage.mlapp to your current working directory.

    Operating SystemDefault File Location
    Windows® C:\Program Files\MATLAB\R2019b\examples\matlab\Mortgage.mlapp
    Linux® /usr/local/MATLAB/R2019b/examples/matlab/Mortgage.mlapp
    macOS /Applications/MATLAB/

Create Web App

  1. Type deploytool at the MATLAB command line, and choose Web App Compiler.

  2. In the MAIN FILE section of the toolstrip, click the button to add the Mortgage.mlapp file to the project.

  3. In the Archive information section, specify the archive name as myMortgageWebApp.

  4. Edit web app information in the Web app information section. Make sure to use a display name that is easy to distinguish when your web app is deployed to the server. This name is visible on the web apps home page.

  5. Change the version number for tracking purposes (optional). The version number is visible on the web apps home page.

  6. Add a description for your web app in the Summary field (optional). This description is visible on the web apps home page.

  7. Click Package to package the app and create a web app archive (.ctf) file.

    In the Save Project dialog box, specify the location to save the project.

  8. In the Package dialog box, select Open output folder when process completes.

    The Web App Compiler app creates a log file PackagingLog.txt and two folders for_redistribution and for_testing that contain the web app archive file myMortgageWebApp.ctf.


    You can use the log file PackagingLog.txt to see the exact mcc syntax used to package and create the web app.

Deploy Web App

  1. Copy the web app archive file myMortgageWebApp.ctf.

  2. Open the MATLAB Web App Server application, and click the Open App Folder button.




    C:\Program Files\MATLAB\MATLABWebAppServer\R2019b\MATLABWebAppServer.exe


    /usr/local/MATLAB/MATLABWebAppServer/R2019b/ <MATLAB_Runtime_Location>



  3. Paste the web app archive file myMortgageWebApp.ctf in the folder that opens.

  4. Click the Open Home Page button.

    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.

Run Web App

  1. To run a web app, click the myMortgageWebApp tile.

    The web app opens in a new tab.

  2. 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.

Related Topics