This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Translate This Page

MathWorks Machine Translation

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

Create Standalone Application from MATLAB

Supported platform: Windows®, Linux®, Mac

This example shows how to generate a standalone application from MATLAB®. You package the prewritten function that prints a magic square to the command
prompt of a computer. MATLAB
Compiler™ produces an installer that installs both the standalone application and all
the required dependencies on a target system. The target system does not require a licensed
copy of MATLAB.

Create Function in MATLAB

In MATLAB, examine the MATLAB code that you want deployed as a standalone application. For this example,
open magicsquare.m located in
matlabroot\extern\examples\compiler.

Create Standalone Application Using Application Compiler App

On the MATLAB Apps tab, on the far right of the
Apps section, click the arrow. In Application
Deployment, click Application
Compiler.

Alternately, you can open the Application Compiler app by
entering applicationCompiler at the MATLAB prompt.

In the MATLAB Compiler project window, specify the main
file of the MATLAB application that you want to deploy.

In the Main File section of the toolstrip, click .

In the Add Files window, browse to
matlabroot\extern\examples\compiler,
and select magicsquare.m. Click
Open.

The function magicsquare.m is added to the list of
main files.

Decide whether to include the MATLAB Runtime installer in the generated application by selecting one of the two
options in the Packaging Options section:

Runtime downloaded from web — Generates an
installer that downloads the MATLAB Runtime and installs it along with the deployed MATLAB application.

Runtime included in package — Generates an
installer that includes the MATLAB Runtime installer.

Note

For every release, the first time you select this option, you are
prompted to download the MATLAB Runtime installer. If you do not have internet access, you
should order a CD of the current version of MATLAB Runtime installer from MathWorks®.

Customize the packaged application and its appearance:

Application information — Editable information
about the deployed application. You can also customize the standalone
applications appearance by changing the application icon and splash
screen. The generated installer uses this information to populate the
installed application metadata. See Customize the Installer.

Files required for your application to run
— Additional files required by the generated application to run.
These files are included in the generated application installer. See
Manage Required Files in Compiler Project.

Files installed for your end user — Files
that are installed with your application. These files include:

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

In the Package dialog box, verify that Open
output folder when process completes is selected.

When the deployment process is complete, examine the generated output.

for_redistribution — Folder containing the
file that installs the application and the MATLAB Runtime.

for_testing — Folder containing all the
artifacts created by mcc, such as binaries and JAR,
header, and source files for a specific target. Use these files to test
the installation. For more information, see Create Standalone Application with mcc.

for_redistribution_files_only — Folder
containing the files required for redistributing the application.
Distribute these files to users who have MATLAB or MATLAB Runtime installed on their machines.

PackagingLog.txt — Log file generated by
MATLAB
Compiler.

Install and Run MATLAB Generated Standalone Application

To install the standalone application, in the
for_redistribution folder, double-click the
MyAppInstaller_web executable.

Note

The file extension varies depending on the platform on which the installer
was generated.

If you want to connect to the Internet using a proxy server, click
Connection Settings. Enter the proxy server settings
in the provided window. Click OK.

To complete installation, follow the instructions on the user
interface.

Note

On Linux and Mac OS X, you do not have the option of adding a desktop
shortcut.

To run your standalone application:

Open a terminal window.

Navigate to the folder into which you installed the
application.

If you accepted the default settings, you can find the folder in one
of the following locations:

Windows

C:\Program
Files\magicsquare

Mac OS X

/Applications/magicsquare

Linux

/usr/magicsquare

Run the application using one of the following commands:

Windows

application\magicsquare
5

Mac OS X

You must set the
DYLD_LIBRARY_PATH environment
variable in the command window for the standalone
application to work as
follows: