【发布时间】:2020-01-21 14:15:05
【问题描述】:
运行这段代码时出现下面的代码:
import numpy as np
from scipy.io import loadmat
mat = loadmat("/home/sami/sami/Dataset/mat/2018-03-11-19-42-58_atis_humanity_star_slewing_td.mat")
matTD = mat['TD']
matX = matTD['x'][0,0]
matY = matTD['y'][0,0]
matTs = matTD['ts'][0,0].astype('int32')
matP = matTD['p'][0,0]
它发生在这些线上:
matX = matTD['x'][0,0]
matY = matTD['y'][0,0]
matTs = matTD['ts'][0,0].astype('int32')
matP = matTD['p'][0,0]
这是输出错误:
matX = matTD['x'][0,0]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
这是我的矩阵的样子:
[[ 122 209 0 665074460]
[ 13 68 0 665074490]
[ 152 30 0 665074603]
...
[ 270 56 0 694569547]
[ 270 56 0 694569547]
[ 152 30 0 694569619]]
【问题讨论】:
-
你可能想要
:,而不是,...? -
我试过同样的错误出现
标签: python