如何用python打开big-endian编码(ieee be)?

如何用python打开big-endian编码(ieee be)?,python,numpy,file,binary,endianness,Python,Numpy,File,Binary,Endianness,我有一个打开.eeg文件的matlab代码: f_in=fopen(a_eegfile,'r','ieee-be');% open file where eeg data are with Big-endian encoding 它给了我一个一维的双倍矩阵。(793456x1) 我试图用python和numpy做同样的事情: data_f = np.fromfile(os.path.join(root,folder,filename), dtype='>f8') 这是可行的,但我得到的

我有一个打开.eeg文件的matlab代码:

f_in=fopen(a_eegfile,'r','ieee-be');% open file where eeg data are with Big-endian encoding
它给了我一个一维的双倍矩阵。(793456x1)

我试图用python和numpy做同样的事情:

data_f = np.fromfile(os.path.join(root,folder,filename), dtype='>f8')
这是可行的,但我得到的矩阵完全不同。 可能是dtype参数有问题,但我找不到

有人能帮忙吗

见:


因此,最终的结果远不止这些:

打开(os.path.join(根目录、文件夹、文件名),'rb')作为文件:
data=file.read()
data\u f=np.array([x代表数据中的x])
data_f现在存储我的(793456x1)整数矩阵

print(类型(数据类型)、len(数据类型)、数据类型)
给我:

16695840 int32

以np为numpy


希望这对其他人有用。

我尝试使用print(struct.unpack('>d',data_f)),但我收到一个结构错误,说(struct.error:unpack需要8字节的缓冲区),我尝试使用'>i1',效果更好。除了像192这样的大值,我得到-64