Create Deployable Archive for MATLAB Production Server - MATLAB & Simulink (original) (raw)

Main Content

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 18

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

You can specify additional options in thecompiler.build command by using name-value arguments. For details, see compiler.build.productionServerArchive.
The compiler.build.Results objectbuildResults contains information on the build type, generated files, included support packages, and build options.
The function generates the following files within a folder namedaddmatrixproductionServerArchive in your current working directory:

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

Topics