我正在尝试将 Matlab 代码转换为二进制文件的 Python。请原谅我是这门语言的新手。
Matlab:
fileID = fopen('file_name.bin','r');
DC = fread(fileID,'single','b');
Python:
import numpy as np
with open('Duty_Cycle.bin','rb') as fid:
data_array = np.fromfile(fid, np.float32, dtype = '>u4')
print(data_array)
结果:
TypeError: argument for fromfile() given by name ('dtype') and position (2)
我该如何解决这个错误?
慕桂英3389331
相关分类