A data file binaryFile.bin was written as so in MATLAB:
stream = fopen (dst_file.c_str(),"wb");
fwrite(data,sizeof(float),4*num,stream);
fclose(stream);
I would like to retrieve this in Python. What I have tried thus far is:
fileName = '~/binaryFile.bin'
with open(fileName, mode='rb') as file:
fileContent = file.read()
This gives me fileContent, which is a python string. (For example, the first couple samples look something like this: "94QB\\x9a\\x99\\xe9@)\\").
I simply want to read back the entire fileContent as the original array of floats. How do I do that? Thanks.
len(fileContent))? Is that the whole file you gave us? 19 bytes does not really fit any known float format.len(fileContent)gives 1919632arraymodule.