MATLAB: How to import and read a binary file in Matlab

binarydata importMATLAB

I have a .bin file with data which was saved as '16-bit, Intel format with no header'. Is it possible to import and read and if so how? I have tried without success using fopen and fread.
Thanks a lot for any help!

Best Answer

  • "16 bit Intel format" is not unique. It could be an UINT16, INT16, FP16. "Intel format" means "little endian". Some ideas:
    fileID = fopen(filename, 'r', 'ieee-le');
    if fileID == -1, error('Cannot open file: %s', filename); end
    format = 'uint16';
    Data = fread(fileID, Inf, format);
    Then try to set format to 'int16'. You cannot read FP16 directly, but it is not very common also, see
    You have mentioned, that you've "tried without success using fopen and fread". Then post the code and explain the problems. Perhaps there was a typo only.