Matlab ≥ R2014b calling Python can only send a 1xN vector. You have to reshape the matrix into a 1xN vector when passing the matrix into Python, and reshape back to a matrix inside Python, involving memory copies at both Matlab reshapings.
Note that Numpy
ndarray is not understandable by Matlab, so you will have to make your Numpy array into a 1-D list and then send it back.
That’s a lot of memory copying!
I can pass
ans=[ 1.41421356 1.41421356]
Does not work
Error using py.numpy.sqrt Conversion of MATLAB ‘double’ to Python is only supported for 1-N vectors.
Mathworks confirms: cannot pass normal 2D matrices to Python from Matlab