Main Content

Connect MATLAB Session to MATLAB Production Server

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

You must enable the discovery service on each server instance that hosts the MATLAB functions.

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

Related Topics