Create Deployable Archive for MATLAB Production Server
Supported platform: Windows®, Linux®, Mac
To create a deployable archive, you need an installation of the MATLAB® Compiler SDK™ product.
This example shows how to create a deployable archive using a MATLAB function. You can then deploy the generated archive on MATLAB Production Server™.
Create MATLAB Function
In MATLAB, examine the MATLAB program that you want to package.
For this example, write a function
addmatrix.m as follows.
function a = addmatrix(a1, a2) a = a1 + a2;
At the MATLAB command prompt, enter
addmatrix([1 4 7; 2 5 8; 3 6 9], [1 4
7; 2 5 8; 3 6 9]).
The output is:
ans = 2 8 14 4 10 16 6 12 18
Create Deployable Archive with Production Server Compiler App
Package the function into a deployable archive using the Production Server Compiler app. Alternatively, if you want to create a deployable archive from the MATLAB command window using a programmatic approach, see Create Deployable Archive Using compiler.build.productionServerArchive.
To open the Production Server Compiler app, type
productionServerCompilerat the MATLAB prompt.
Alternatively, on the MATLAB Apps tab, on the far right of the Apps section, click the arrow. In Application Deployment, click Production Server Compiler. In the Production Server Compiler project window, click Deployable Archive (.ctf).
In the Production Server Compiler project window, specify the main file of the MATLAB application that you want to deploy.
In the Exported Functions section, click .
In the Add Files window, browse to the example folder, and select the function you want to package.
Doing so adds the function
addmatrix.mto the list of main files.
Customize Application and Its Appearance
Customize your deployable archive and add more information about the application.
Archive information — Editable information about the deployed archive.
Additional files required for your archive to run — Additional files required to run the generated archive. These files are included in the generated archive installer. See Manage Required Files in Compiler Project.
Files packaged for redistribution — Files that are installed with your archive. These files include:
Generated deployable archive
Include MATLAB function signature file — Add or create a function signature file to help clients use your MATLAB functions. See MATLAB Function Signatures in JSON.
To generate the packaged application, click Package.
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 archive
for_testing— Folder containing the raw generated files to create the installer
PackagingLog.html— Log file generated by MATLAB Compiler SDK
Create Deployable Archive Using
As an alternative to the Production Server Compiler app, you can create a deployable archive using a programmatic approach.
Build the deployable archive using the
buildResults = compiler.build.productionServerArchive('addmatrix.m', ... 'Verbose','on');
You can specify additional options in the
compiler.buildcommand by using name-value arguments. For details, see
buildResultscontains information on the build type, generated files, included support packages, and build options.
The function generates the following files within a folder named
addmatrixproductionServerArchivein your current working directory:
addmatrix.ctf— Deployable archive file.
includedSupportPackages.txt— Text file that lists all support files included in the assembly.
mccExcludedFiles.log— Log file that contains a list of any toolbox functions that were not included in the application. For information on non-supported functions, see MATLAB Compiler Limitations.
readme.txt— Text file that contains packaging and deployment information.
requiredMCRProducts.txt— Text file that contains product IDs of products required by MATLAB Runtime to run the application.
unresolvedSymbols.txt— Text file that contains information on unresolved symbols.
In most cases, you can generate the deployable archive 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.