, mdict=None, appendmat=True, **kwargs)

Load Matlab(tm) file

file_name : string
Name of the mat file (do not need .mat extension if appendmat==True) If name not a full path name, search for the file on the sys.path list and use the first one found (the current directory is searched first). Can also pass open file-like object
m_dict : dict, optional
dictionary in which to insert matfile variables
appendmat : {True, False} optional
True to append the .mat extension to the end of the given filename, if not already present
base_name : string, optional, unused
base name for unnamed variables. The code no longer uses this. We deprecate for this version of scipy, and will remove it in future versions
byte_order : {None, string}, optional
None by default, implying byte order guessed from mat file. Otherwise can be one of (‘native’, ‘=’, ‘little’, ‘<’, ‘BIG’, ‘>’)
mat_dtype : {False, True} optional
If True, return arrays in same dtype as would be loaded into matlab (instead of the dtype with which they are saved)
squeeze_me : {False, True} optional
whether to squeeze unit matrix dimensions or not
chars_as_strings : {True, False} optional
whether to convert char arrays to string arrays
matlab_compatible : {False, True}
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_record : {False, True} 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 behaviour of scipy version 0.6 (returning numpy object arrays). The preferred setting is True, because it allows easier round-trip load and save of matlab files. In a future version of scipy, we will change the default setting to True, and following versions may remove this flag entirely. For now, we set the default to False, for backwards compatibility, but issue a warning. Note that non-record arrays cannot be exported via savemat.


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.

Previous topic

Input and output (

Next topic

This Page

Quick search