Note that for Matlab R2014b and newer calling Python, you can only send to Python 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 ndarrays are not understandable by Matlab, 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
py.numpy.sqrt([2,2]) ans=[ 1.41421356 1.41421356]
but I cannot pass
py.numpy.sqrt([2,2;2,2]) Error using py.numpy.sqrt Conversion of MATLAB 'double' to Python is only supported for 1-N vectors.