User Guide¶
By importing this package, you can use Bob native array reading (bob.io.base.load()
) and
writing (bob.io.base.save()
) routines to load and save files using the Matlab(R) .mat
format.
>>> import bob.io.base
>>> import bob.io.matlab #under the hood: loads Bob plugin for '.mat' files
>>> x = bob.io.base.load('myfile.mat')
This package also contains a couple of other methods that allow for reading
variable names and matrices from .mat
files. Proceed to the
Python API section for details.
Warning
Currently, reading the .mat
files with a cell inside leads to a crash.
You can refer to SciPy Cookbook for alternative solutions.
Be Portable¶
An alternative for saving data in .mat
files using
bob.io.base.save()
, would be to save them as HDF5 files which then
can be easily read inside Matlab. The HDF5 format is well supported in
Matlab(R) - as a matter of fact, the newest version of .mat files uses
the HDF5 format.
Similarly, instead of having to read .mat
files using
bob.io.base.load()
, you can save your Matlab data in HDF5 format,
which then can be easily read from Bob, without this add-on. Detailed
instructions about how to save and load data from Matlab to and from HDF5
files can be found here.