首先给出官网链接,其中详细说明了在Python下如何用Numpy实现Matlab下相同的函数功能。
博主在用Python撰写代码的时候,想用Python实现在Matlab下某个函数的功能(比如Repmat函数),但是当使用语句
from numpy.matlib import repmat
A = repmat(B, 1, 2)
调用工具包时,虽然可以正常实现功能,但是PyCharm下报出警告:
Importing from numpy.matlib is deprecated since 1.19.0. The matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
随后,通过查阅资料,发现是因为从1.19.0版本后,numpy就不再推荐使用numpy.matlib来实现对应功能了。因此,大家可以对照官网上的说明来实现替换。这里截取一小部分:
其他的可以从官网上面找到。