我想从matlab到python(numpy)编写以下操作。
repmat(总和(数据,2),1,20);
答案 0 :(得分:0)
查看What is the equivalent of MATLAB's repmat in NumPy
我会建议像
这样的东西import numpy as np
np.tile(np.sum(data, axis=1), 1, 20)
axis=1
指的是求和的维数。据我记得,matlab用1开始索引计数,在python / numpy中以0开头。
希望这就是你要找的东西。