Does anyone know of any methods of extracting the data from a MATLAB fig file using Python? I know these are binary files but the methods in the Python Cookbook for .mat files http://www.scipy.org/Cookbook/Reading_mat_files don’t seem to work for .fig files…
Thanks in advance for any help,
Dan
.fig files are .mat files (containing a struct), see
http://undocumentedmatlab.com/blog/fig-files-format/
As the reference you give states, structs are only supported up to v7.1:
http://www.scipy.org/Cookbook/Reading_mat_files
So, in MATLAB I save using -v7:
Then in Python 2.6.4 I use:
Where I used
.__dict__to see how to traverse the structure. E.g. to getXDataandYDataI can use:Showing that I’d used
plot([1 2],[3 4])in MATLAB (the child is the axis and the grandchild is the lineseries).