I want to read from a binary data file, in the old matlab version of my script this is done by
file=fread(data,'bit16');
which would be the equivalent thing in python ? i tried
with open file(data, "rb") as f:
d = np.fromfile(f, "<i2", count = 10000)
since the matlab documentation says that bitn is of the type signed integer with n bits
i tried different dtypes ( "<>i2", "int16") unfortunately this doesnt give me the rigth data.
datafile?np.fromfile('test.dat', np.int16)properly recovers data written from matlab withfwrite(fid, data, 'bit16')on my system.