使用 scipy 加载 .mat 文件时不是预期的结果
Not the expected result while loading .mat file with scipy
我在使用 scipy、
从 .mat
文件加载一些数据时遇到以下问题
varI = variable_names
M = scipy.io.loadmat('path\file.mat', variable_names = varI)
我得到的是,
{'__version__': '1.0', 'SensorI': array([[ 21809339.],
[ 21809339.],
[ 21809339.],
...,
[ 21809379.],
[ 21809379.],
[ 21809379.]]), '__header__': '', '__globals__': []}
但这还不是全部数据。原始变量是SensorI 4013x1 32104 double'
。你知道为什么我没有得到全部数据吗?
你写 "the goal is to get the whole array at once" --- 整个数组实际上已经存在,M["SensorI"]
为你得到它就好了。 "get" 你的意思似乎是 "print"。默认情况下打印数组只是省略一些元素,以避免输出数千行。
您显然想要调整数组的显示方式。
使用 numpy.set_printoptions(edgeitems=numpy.inf) 始终显示所有元素。
但是,您可能对输出中“...”的含义感到困惑 --- 这意味着那里有数据,但不仅仅是打印出来的。
我在使用 scipy、
从.mat
文件加载一些数据时遇到以下问题
varI = variable_names
M = scipy.io.loadmat('path\file.mat', variable_names = varI)
我得到的是,
{'__version__': '1.0', 'SensorI': array([[ 21809339.],
[ 21809339.],
[ 21809339.],
...,
[ 21809379.],
[ 21809379.],
[ 21809379.]]), '__header__': '', '__globals__': []}
但这还不是全部数据。原始变量是SensorI 4013x1 32104 double'
。你知道为什么我没有得到全部数据吗?
你写 "the goal is to get the whole array at once" --- 整个数组实际上已经存在,M["SensorI"]
为你得到它就好了。 "get" 你的意思似乎是 "print"。默认情况下打印数组只是省略一些元素,以避免输出数千行。
您显然想要调整数组的显示方式。 使用 numpy.set_printoptions(edgeitems=numpy.inf) 始终显示所有元素。
但是,您可能对输出中“...”的含义感到困惑 --- 这意味着那里有数据,但不仅仅是打印出来的。