matfile_version — SciPy v1.15.2 Manual (original) (raw)

scipy.io.matlab.

scipy.io.matlab.matfile_version(file_name, *, appendmat=True)[source]#

Return major, minor tuple depending on apparent mat file type

Where:

  1. 0,x -> version 4 format mat files
  2. 1,x -> version 5 format mat files
  3. 2,x -> version 7.3 format mat files (HDF format)

Parameters:

file_namestr

Name of the mat file (do not need .mat extension if appendmat==True). Can also pass open file-like object.

appendmatbool, optional

True to append the .mat extension to the end of the given filename, if not already present. Default is True.

Returns:

major_version{0, 1, 2}

major MATLAB File format version

minor_versionint

minor MATLAB file format version

Raises:

MatReadError

If the file is empty.

ValueError

The matfile version is unknown.

Notes

Has the side effect of setting the file read pointer to 0