Read .mat files in Python

后端 未结 8 1729
时光说笑
时光说笑 2020-11-22 09:23

Is it possible to read binary MATLAB .mat files in Python?

I\'ve seen that SciPy has alleged support for reading .mat files, but I\'m unsuccessful with it. I install

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 09:43

    Reading the file

    import scipy.io
    mat = scipy.io.loadmat(file_name)
    

    Inspecting the type of MAT variable

    print(type(mat))
    #OUTPUT - 
    

    The keys inside the dictionary are MATLAB variables, and the values are the objects assigned to those variables.

提交回复
热议问题