Got an “error closing file” today while saving a very large MAT file in MATLAB. I’ve been dumping my workspace into a MAT file at different stages of a very large computation for debugging purposes and today it broke. It seems that even though I’m running MATLAB 7.9.0 (R2009b), the default is to save MAT files in version 7 format, which has a 2GB size limit. As of version 7.3 (R2006b), the MAT format uses the HDF5 format and removes the 2GB limit. This can be fixed by specifying the switch ‘-v7.3’ in the save command or editing the settings in File > Preferences > General > MAT-Files.