MATLAB: Does FSEEK behave differently in MATLAB 7.0.1 (R14SP1) compared to earlier releases

bytefreadfseekMATLABoffset

I am using FSEEK and FREAD to read a binary file. In previous versions of MATLAB, I could read less than a whole byte of data, call FSEEK, and then a subsequent call to FREAD would complete the read of a partial byte of data before going on to a new byte. In MATLAB 7.0.1 (R14SP1), it appears that the second call to FREAD starts at the beginning of the new byte.

Best Answer

We have verified that there has been a change in the way FSEEK operates in MATLAB 7.0.1 (R14SP1). Note that this change is a correction of past behavior that was considered a bug. The correct behavior as currently implemented is for FSEEK to ignore partially read bytes. That is, if you read a partial byte and then perform an FSEEK, the file pointer is set at the beginning of the specified byte, from where a subsequent call to FREAD will begin.