print('From list')
print(timeit.timeit('np.array(x)', setup=setup_range, number=1000))
print('From matlab')
print(timeit.timeit('np.array(x)', setup=setup_matlab, number=1000))
print('From matlab_data')
print(timeit.timeit('np.array(x._data)', setup=setup_matlab, number=1000))
How to efficiently convert Matlab engine arrays to numpy ndarray?