Main Content

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

float(nan)

NaN

float(inf)

Inf

bool

logical

str

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

uint8 array

list

Cell array

set

Cell array

tuple

Cell array

Unsupported Python Types

The MATLAB Engine API does not support these Python types.

  • Python class (module.type) objects

  • None

Related Topics