MATLAB: How to load MAT-files generated by MATLAB 7.0 (R14) in prior versions

compatibilityhgsavematMATLABpriorr14saveunloadableversions

I would like to know how to load MAT-files generated by MATLAB 7.0 (R14) in prior versions.

Best Answer

The ability to load MAT-files generated by MATLAB 7.0 (R14) in prior versions of MATLAB is not available, by default, if strings or figures are stored in the MAT-file.
This is a result of a change in how characters are stored in R14, which uses Unicode data encoding rather than ASCII data encoding. The default encoding can be overridden by using the -v6 flag. For example, when using the SAVE function to store variables into a MAT-file:
save filename -v6
Similarly, use the -v6 flag if saving figures to a FIG-file:
hgsave(filename, '-v6')
If you create a MAT-file in R14 and intend to read that MAT-file with an earlier version of MATLAB, you must use the -v6 flag in order to store it in a format that the earlier version can read correctly.
If you wish to store files using the -v6 option by default, you may change this setting in your preferences by selecting the "Ensure backward compatibility (-v6)", available in the General preferences section under the heading: "MAT-Files".