Matlab fseek bug with uint64 offset

Note: This problem was fixed in Matlab ≥ R2015a, but was broken in Matlab R2013a/R2013b. Not sure about R2014a/R2014b.

Matlab R2013a/R2013b cannot handle uint64 seek offsets. However, Octave ≥ 3.6 can work with uint64 offsets.


offs = uint64(0); %or any number
fid = fopen('test.dat');
fser = fseek(fid,offs,'bof');
  • fser == -1 for Matlab R2013a/R2013b (error)
  • fser == 0 for Octave (correct)