0
As the comments suggest, you need to use a file descriptor, which is what the Matlab code is doing:
import numpy as np
def fread(fid, n, precision):
data_array = np.fromfile(fid, precision).reshape((-1, 1)).T
return data_array[0,0:n]
fid = open('test.bin', 'rb');
print fread(fid, 2,...