scipy.io.whosmat¶
-
scipy.io.
whosmat
(file_name, appendmat=True, **kwargs)[source]¶ List variables inside a MATLAB file.
- 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.
- byte_orderstr or None, optional
None by default, implying byte order guessed from mat file. Otherwise can be one of (‘native’, ‘=’, ‘little’, ‘<’, ‘BIG’, ‘>’).
- mat_dtypebool, optional
If True, return arrays in same dtype as would be loaded into MATLAB (instead of the dtype with which they are saved).
- squeeze_mebool, optional
Whether to squeeze unit matrix dimensions or not.
- chars_as_stringsbool, optional
Whether to convert char arrays to string arrays.
- matlab_compatiblebool, optional
Returns matrices as would be loaded by MATLAB (implies squeeze_me=False, chars_as_strings=False, mat_dtype=True, struct_as_record=True).
- struct_as_recordbool, optional
Whether to load MATLAB structs as NumPy record arrays, or as old-style NumPy arrays with dtype=object. Setting this flag to False replicates the behavior of SciPy version 0.7.x (returning numpy object arrays). The default setting is True, because it allows easier round-trip load and save of MATLAB files.
- Returns
- variableslist of tuples
A list of tuples, where each tuple holds the matrix name (a string), its shape (tuple of ints), and its data class (a string). Possible data classes are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, single, double, cell, struct, object, char, sparse, function, opaque, logical, unknown.
Notes
v4 (Level 1.0), v6 and v7 to 7.2 matfiles are supported.
You will need an HDF5 python library to read matlab 7.3 format mat files. Because SciPy does not supply one, we do not implement the HDF5 / 7.3 interface here.
New in version 0.12.0.