Python Client Programming

Create client programs in Python®

The MATLAB® Production Server™ Python client API enables developers to evaluate MATLAB functions on remote servers. The API lets you pass scalar values to a MATLAB function using native Python types. When working with arrays, you need to use the MATLAB array types provided in the matlab package. For information on using MATLAB arrays in Python, see MATLAB Arrays as Python Variables.

For an overview of how to create client programs, see Create a MATLAB Production Server Python Client.

For a complete example of a client implementation, see Create a Python Client.

Classes

matlab.production_server.client.MWHttpClientPython object encapsulating a connection to a MATLAB Production Server instance

Examples and How To

Install the MATLAB Production Server Python Client

Install the packages required to use the Python client

Create a MATLAB Production Server Python Client

To create a MATLAB Production Server client:

Create Client Connection

Create a connection from a Python client to a MATLAB Production Server instance

Use MATLAB Arrays in Python

This example shows how to use MATLAB arrays in Python.

Invoke MATLAB Functions that Return Zero Outputs

Create calls to functions that return no output

Invoke MATLAB Functions that Return a Single Output

Create calls to functions that return one result

Invoke MATLAB Functions that Return Multiple Outputs

Create calls to functions that return two, or more, results

Handle Function Processing Errors

Catch and process errors returned from the server

Concepts

Pass Data to MATLAB Production Server from Python

When you pass data as input arguments to MATLAB functions from Python, MATLAB Production Server converts the data into equivalent MATLAB data types.

Handle Data Returned from MATLAB Production Server to Python

When MATLAB functions return output arguments, MATLAB Production Server converts the data into equivalent Python data types.

MATLAB Arrays as Python Variables

Python representation of MATLAB data types

Was this topic helpful?