Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Pass Data to MATLAB from Python

Python Type to MATLAB Scalar Type Mapping

When you pass Python® data as input arguments to MATLAB® functions, the MATLAB Engine for Python converts the data into equivalent MATLAB data types.

Python Input Argument Type —
Scalar Values Only

Resulting MATLAB Data Type

float

double

complex

Complex double

int

int64

long (Python 2.7 only)

int64

float(nan)

NaN

float(inf)

Inf

bool

logical

str

char

unicode (Python 2.7 only)

char

dict

Structure if all keys are strings
not supported otherwise

Python Container to MATLAB Array Type Mapping

Python Input Argument Type —
Container

Resulting MATLAB Data Type

matlab numeric array object (see MATLAB Arrays as Python Variables)

Numeric array

bytearray

uint8 array

bytes (Python 3.x)
bytes (Python 2.7)

uint8 array
char array

list

Cell array

set

Cell array

tuple

Cell array

Unsupported Python Types

The following Python types are not supported by the MATLAB Engine API for Python:

Related Topics

Was this topic helpful?