我想我错过了某个地方.我使用两个for循环(x和y)和一个基于x,y位置的函数填充了一个numpy数组.唯一的问题是,无论数组的大小如何,数组的值总是以零结尾.
thetamap = numpy.zeros(36, dtype=float)
thetamap.shape = (6, 6)
for y in range(0,5):
for x in range(0,5):
thetamap[x][y] = x+y
print thetamap
Run Code Online (Sandbox Code Playgroud)