In this video, we show how you can create Standalone Applications from your MATLAB programs by using MATLAB Compiler. You can share these applications with users who do not need to modify the underlying code. This application, for example, does not need MATLAB installed to run it. You can load custom files, get an audio response when you click on this button, and also get a visual output, thanks to MATLAB graphics.
But before we can use the application, we need to design it in MATLAB. You will use the guide feature in MATLAB to build this SUI, along with some MATLAB programming to do the back-end computation. To be able to share this application such that it runs without the need of a MATLAB installation, you can use the MATLAB Compiler add-on product.
Open the Application Compiler that is inside the MATLAB Apps Gallery. Within this interface, you pick the main MATLAB file that you created for programming your application. Once you pick the main file, MATLAB Compiler automatically recognizes some file dependencies, like MATLAB functions being used in the main program, and the FIG file needed for the user interface. I can add some user specific data through a MAT file, which is essentially a basic MATLAB file type used to store MATLAB variables and objects.
Next, you have options like choosing an icon, and a splash screen that shows up when the user of your application is installing it on their machine. More options here allow you to add additional customizations, such as version number and author information. Once you are all set with the customizations, you have the option to package in the Automatic Installer for MATLAB Runtime Libraries. The applications will use these front time libraries to run on the target machine, instead of requiring an installation of MATLAB.
You can either leave this option to the default download from Web Option, or it can add MATLAB runtime libraries with the package by choosing this other option. MATLAB Runtime is a onetime installation, so the application setup will skip this installation if it finds the right libraries already installed on the computer. Having said all the options, we can now package this application to create a shareable file. Once the packaging is complete, you'll see a far redistribution folder created for you. Inside this folder, there is this single setup file that you can share with your users or colleagues who do not have MATLAB.
On your user's computer, executing this setup file brings up the application installer with the splash screen we had picked. Once the installation is complete, the application appears in the programs list and runs like any other program without needing MATLAB. To summarize, you start by creating your application in MATLAB. Then use the MATLAB Compiler to create an installer that can be shared with your users. On the user's machine, the installer will automatically install the application, along with the runtime libraries that it needs to run with.
To learn more about the MATLAB Compiler, please visit the product web page on mathworks.com, or choose a link below.