Create Deployable Archive for MATLAB Production Server
Supported platform: Windows®, Linux®, Mac
Note
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    18Create Deployable Archive Using                     compiler.build.productionServerArchive
Package the function into a deployable archive using a programmatic approach. Alternatively, if you want to create a deployable archive using a graphical approach, see Create MATLAB Production Server Archive Using Production Server Archive Compiler App (MATLAB Compiler SDK).
- Build the deployable archive using the - compiler.build.productionServerArchivefunction.- Optionally, you can add a function signature file to help clients use your MATLAB functions. For more details, see MATLAB Function Signatures in JSON. - Note - compiler.build.productionServerArchivedoes not support semantic versioning. Attempting to build a deployable archive from a MATLAB function with a name containing the "." character will result in an error.- buildResults = compiler.build.productionServerArchive('addmatrix.m',... 'FunctionSignatures','addmatrixFunctionSignatures.json',... 'Verbose','on'); - buildResults = Results with properties: BuildType: 'productionServerArchive' Files: {'/home/mluser/Work/magicarchiveproductionServerArchive/addmatrix.ctf'} IncludedSupportPackages: {} Options: [1×1 compiler.build.ProductionServerArchiveOptions] RuntimeDependencies: [1×1 compiler.runtime.Dependencies]- You can specify additional options in the - compiler.buildcommand by using name-value arguments. For details, see- compiler.build.productionServerArchive(MATLAB Compiler SDK).- The - compiler.build.Resultsobject- 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 (MATLAB Compiler).
- 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.
 
Compatibility Considerations
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. For releases before R2019b, compile deployable archives on the same platform as the server you will be running them on. (since R2019b)
See Also
Functions
- compiler.build.productionServerArchive(MATLAB Compiler SDK) |- mcc(MATLAB Compiler)