After I tried every solution I found online, I must ask here. I want to achieve the behavior of matlab's corr function: I have 2 matrices A and B. A's shape: (200, 30000) B's shape: (200, 1) in matlab, corr(A, B) will return a matrix with size (30000, 1). when I use numpy.corrcoef (or dask for better performance) I get a (30001, 30001) matrix which is extremely huge, and a wrong answer. I tried using argument rowvar=False as some answer suggested, but it didnt work as well. I even tried scipy.spatial.distance.cdist(np.transpose(traces), np.transpose(my_trace), metric='correlation') which indeed returned a matrix in shape(30000, 1) as expected but the values were differnet then the result in matlab. I am desperate for a solution for this problem, please help. Continue reading...