How to extract data from Matlab .fig files in Python? -


if have x vs y data saved in matlab .fig file, there way extract data in python? i've tried using method shown in previous discussion, not work me. have tried open files using h5py , pytables, since .mat files hdf5 files now, results in error valid file signature can't found.

currently i'm trying anaconda distribution of python 3.4.

edit: managed figure out works, don't know why. has me worried might break in future , won't able debug it. if can explain why works, method in old discussion doesn't i'd appreciate it.

from scipy.io import loadmat d = loadmat('linear.fig', squeeze_me=true, struct_as_record=false) x = d['hgs_070000'].children.children.properties.xdata y = d['hgs_070000'].children.children.properties.ydata 

the best way can think of using of matlab-python bridge (such pymatbridge).

you can call matlab code directly on python files , transform data 1 other. use matlab code load fig , extract data , convert numerical variables python arrays (or numpy arrays) easily.


Popular posts from this blog