Pass Data Between MATLAB Production Server and Python
Pass Data from MATLAB to Python
When you pass data from MATLAB® to Python®, either directly or as output from a MATLAB function in Python, MATLAB Production Server™ converts the data into the equivalent Python data types.
MATLAB Output Argument Type | Resulting Python Data Type |
---|---|
Numeric array |
|
|
|
Complex (any numeric type) |
|
|
|
|
|
|
|
|
|
|
|
|
|
string array (1-by-N or
N -by-1) |
|
|
|
cell array (1-by- |
|
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
table timetable | This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
MATLAB handle object (such as the
| This conversion is not supported for MATLAB Production Server. |
MATLAB value object (such as the | This conversion is not supported for MATLAB Production Server. |
Unsupported MATLAB Data Types
Along with the exceptions noted in the table, MATLAB does not convert these MATLAB data types to Python data types:
char
array (M
-by-N
)string
array (M
-by-N
)cell array (
M
-by-N
)Sparse array
struct
arrayObjects not produced by MATLAB (such as Java® objects)
Function handle
Pass Data from Python to MATLAB
When you pass data from Python to MATLAB, either directly or as input arguments to a MATLAB function in Python, MATLAB Production Server converts the data into the equivalent MATLAB data types.
Python Data Type | Resulting MATLAB Data Type |
---|---|
| Numeric array |
Python objects that support the buffer protocol, such as
| Numeric array |
|
|
| Complex |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
| This conversion is not supported for MATLAB Production Server. |
Python objects other than | This conversion is not supported for MATLAB Production Server. |
Unsupported Python Data Types
Along with the exceptions noted in the table, MATLAB does not convert these Python data types to MATLAB data types:
Python class (
module.type
) objectsNone
object