Main Content

Connect MATLAB Session to MATLAB Production Server

MATLAB® Client for MATLAB Production Server™ makes the functions deployed on on-premises MATLAB Production Server instances available in your MATLAB session.

When to Use MATLAB Client for MATLAB Production Server

MATLAB Client for MATLAB Production Server enables you to do the following:

  • Scale with demand: Shift computationally intensive work from MATLAB desktop to server-class machines or scalable infrastructure.

  • Centralize algorithm management: Install MATLAB functions that contain your algorithms on a central server and then run them from any MATLAB desktop, ensuring consistent usage and making upgrades easier.

  • Protect intellectual property: Protect algorithms deployed to the server using encryption.

Using MATLAB Client for MATLAB Production Server is less suitable for algorithms that have the following characteristics:

  • The algorithms are called several times from inside a loop.

  • The algorithms require resources such as files or hardware that are available only on a single machine or to a single person.

  • The algorithms rely on the MATLAB desktop or MATLAB graphics, or use data from a MATLAB session.

Install MATLAB Client for MATLAB Production Server

Install the MATLAB Client for MATLAB Production Server support package from the MATLAB Add-On Explorer. For information about installing add-ons, see Get and Manage Add-Ons (MATLAB).

After your installation is complete, find examples in support_package_root\toolbox\mps\matlabclient\demo, where support_package_root is the root folder of support packages on your system. Access the documentation by entering the doc command at the MATLAB command prompt or by clicking the Help button. In the Help browser that opens, navigate to MATLAB Client for MATLAB Production Server under Supplemental Software.

Connect MATLAB Session to MATLAB Production Server

MATLAB Client for MATLAB Production Server uses MATLAB add-ons to connect a MATLAB session to MATLAB functions deployed on server instances. The connection between a server instance and a MATLAB desktop session consists of two parts:

  1. A MATLAB Production Server deployable archive that publishes one or more functions.

  2. A MATLAB add-on that makes those functions available in MATLAB.

You must include a MATLAB function signature file when you create the deployable archive. For more information, see MATLAB Function Signatures in JSON. The server instance that hosts the deployable archive must have the discovery service enabled. For more information, see Discovery Service.

You must install a MATLAB Production Server add-on to connect a MATLAB desktop session to an archive deployed on a server instance. For example, for an archive mathfun deployed to a server instance running on at port 31415, you can install the corresponding add-on with a single command:

>> prodserver.addon.install('mathfun','',31415);

Then, you can call the functions in that archive from the MATLAB desktop, script, and function files. For example, if the deployed archive contains a function mymagic that takes an integer input and returns a magic square, you can call mymagic from the MATLAB command prompt.

>> mymagic(3)

For a detailed example, see Execute Deployed MATLAB Functions.

System Requirements

MATLAB Client for MATLAB Production Server has the same system requirements as MATLAB. For more information, see System Requirements for MATLAB.

Synchronous Function Execution

MATLAB programs are synchronous. Given a sequence of MATLAB function calls, MATLAB waits for each function to complete before calling the next one. Therefore, the MATLAB Production Server add-on functions are also synchronous. The add-ons use the MATLAB Production Server RESTful API for synchronous function execution. For more information about the RESTful API, see Synchronous Execution.

Supported Data Types

MATLAB Client for MATLAB Production Server supports all data types that the MATLAB Production Server RESTful API supports, which are as follows:

  • Numeric types: double, single, all integer types, complex numbers, NaN, Inf and -Inf.

  • Character arrays

  • Logical

  • Cell arrays

  • Structures

  • String arrays

  • Enumerations

  • Datetime arrays

See Also

Related Topics