MATLAB Examples

Use Python Numeric Types in MATLAB

This example shows how to use Python® numbers in MATLAB®. The trigonometry functions in the math module return Python float types.

pynum = py.math.radians(90)
pynum =

    1.5708

MATLAB automatically converts this type to double.

class(pynum)
ans =

  1×6 char array

double