Documentation Center

  • Trial Software
  • Product Updates

MAT-File Versions

Default Version

By default, all save operations except new file creation with the matfile function create Version 7 MAT-files. Override the default to:

  • Allow access to the file using earlier versions of MATLAB®.

  • Take advantage of Version 7.3 MAT-file features: data items larger than 2 GB on 64-bit systems, and saving or loading parts of variables.

      Note:   Version 7.3 MAT-files use an HDF5 based format that requires some overhead storage to describe the contents of the file. For complex nested cell or structure arrays, Version 7.3 MAT-files are sometimes larger than Version 7 MAT-files.

  • Reduce the time required to load and save some files by storing uncompressed data. For more information, see Speeding Up Save and Load Operations.

Overriding the Default MAT-File Version

To identify or change the default version, access the Environment section on the Home tab, and click Preferences. Select MATLAB > General > MAT-Files. Alternatively, specify a MAT-file version as an argument to the save function.

For example, to create a MAT-file named myfile.mat that you can load with MATLAB Version 6, use the following command:


The following table shows the differences between previous and current MAT-file versions.

Value of versionCan Load in MATLAB VersionsSupported Features
'-v7.3'7.3 (R2006b) or laterVersion 7.0 features, plus support for data items greater than or equal to 2 GB on 64-bit systems.
'-v7'7.0 (R14) or laterVersion 6 features, plus data compression and Unicode® character encoding. Unicode encoding enables file sharing between systems that use different default character encoding schemes.
'-v6'5 (R8) or laterVersion 4 features, plus N-dimensional arrays, cell arrays and structures, and variable names greater than 19 characters.
'-v4'allTwo-dimensional double, character, and sparse arrays.

Speeding Up Save and Load Operations

Beginning with Version 7, MATLAB compresses data when writing to MAT-files to save storage space. Data compression and decompression slow down all save operations and some load operations. In most cases, the reduction in file size is worth the additional time spent.

In fact, loading compressed data is sometimes faster than loading uncompressed data. For example, consider a block of data in a numeric array saved to both a 10 MB compressed file and a 100 MB uncompressed file. Loading the first 10 MB takes the same amount of time for each file. Loading the remaining 90 MB from the uncompressed file takes nine times as long as loading the first 10 MB. Completing the load of the compressed file requires only the relatively short time to decompress the data.

However, the benefits of data compression are negligible in the following cases:

  • The amount of data in each item is small relative to the complexity of its container. For example, simple numeric arrays take less time to compress and uncompress than cell or structure arrays of the same size. Compressing arrays that result in an uncompressed file size of less than 3MB offers limited benefit, unless you are transferring data over a network.

  • The data is random, with no repeated patterns or consistent values.

Version 7.3 MAT-files use an HDF5-based format that stores data in compressed chunks. The time required to load part of a variable from a Version 7.3 MAT-file depends on how that data is stored across one or more chunks. Each chunk that contains any portion of the data you want to load must be fully uncompressed to access the data. Rechunking your data can improve the performance of the load operation. To rechunk data, use the HDF5 command line tools, which are part of the HDF5 distribution.

Version 6 MAT-files do not use compression. To create a Version 6 MAT-file, use the methods described in Overriding the Default MAT-File Version.

Was this topic helpful?