【问题标题】:Error in loading a .mat file in jupyter notebook在 jupyter notebook 中加载 .mat 文件时出错
【发布时间】:2020-02-10 21:01:37
【问题描述】:

在 jupyter notebook 中加载 .mat 文件时遇到挫折。这是遇到的问题:

#import mat4py
from scipy.io import loadmat
mat = loadmat('Dog_1_ictal_segment_1.mat')

错误:TypeError: Expecting miMATRIX type here, got 3225714032

mat 文件是从 UPenn 和 Mayo 在 Kaggle 举办的比赛中下载的,https://www.kaggle.com/c/seizure-detection/data

我无权访问原始 matlab 文件,我不确定是否在 v7.3+ 版本下保存了相同的文件。有人可以指导我吗?

【问题讨论】:

  • 你能加载mat("sample_clip.mat")吗?
  • 做到了。 sample_clip.mat 文件加载,但其他文件不加载。文件会损坏吗?

标签: matlab jupyter-notebook loading


【解决方案1】:

在matlab上试试:

fid = fopen('Dog_1_ictal_segment_1.mat');
txt = char(fread(fid,[1,140],'*char'));
fclose(fid);
disp(txt)

我得到了 Patient_8_ictal_segment_1.mat 的 MATLAB 5.0 MAT 文件(相同的比赛)。使用 -v7.3 时,标头应以 MATLAB 7.3 MAT 文件开头。我能够使用您的代码将数据加载到 python 而没有错误。 可能您的数据已损坏,请尝试下载。

【讨论】:

  • 解压时文件似乎损坏了。使用 7-zip 提取器,我能够加载数据。
猜你喜欢
  • 1970-01-01
  • 2017-10-10
  • 2021-09-25
  • 2019-09-17
  • 2021-11-15
  • 2021-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多