MATLAB: Do I receive an “Unable to read MAT-file” error when I load a MAT-file in MATLAB 7.2 (R2006a) and earlier versions

backwardscompatibilitycompatibledatafileformatguidehdfhierarchicalinvalidmatmatfileMATLABopen

A colleague sent me a MAT-file; when I try to load it in MATLAB 7.2 (R2006a) or previous versions, I receive the following error message:
??? Error using ==> load
Unable to read MAT-file D:\MATLAB\Work\test.mat: not a binary MAT-file.
Try LOAD -ASCII to read as text.

Best Answer

To allow users to save data larger than 2 GB, MATLAB 7.3 (R2006b) offers a new HDF5 format for saving MAT-files. The file you are attempting to open may have been created using this format, which is not supported by previous versions of MATLAB.
To work around this issue, you will need to open the file in MATLAB 7.3 (R2006b).
If this version of MATLAB is not available to you, your colleague can resave the file using the '-v7' flag. MAT-files saved in v7 format can be opened by MATLAB 7.0 (R14) and later versions. He can also resave the file using the '-v6' flag; files saved in v6 format can be opened using versions earlier than MATLAB 7.0 (R14).
In MATLAB 7.0 through 7.3 (R14 through R2006b), MAT-files are saved in v7 format by default. In MATLAB 7.3, MAT-files can be saved in HDF5 format by explicitly using the '-v7.3' flag or by changing the save option under File -> Preferences -> General -> MAT-Files.