【发布时间】:2016-02-15 01:11:27
【问题描述】:
我有一个“.mat”文件,据说包含一个 [30720000x4 双] 矩阵(来自加速度计的值)。当我尝试在 Matlab 中使用“导入数据”打开此文件时,出现以下错误:
Error using load
Can't read file F:\vibration_exp_2\GR_UB50n\bearing1\GR_UB50n_1_2.mat.
Error using load
Unknown text on line number 1 of ASCII file
F:\vibration_exp_2\GR_UB50n\bearing1\GR_UB50n_1_2.mat
"MATLAB".
Error in uiimport/runImportdata (line 456)
datastruct = load('-ascii', fileAbsolutePath);
Error in uiimport/gatherFilePreviewData (line 424)
[datastruct, textDelimiter, headerLines]= runImportdata(fileAbsolutePath,
type);
Error in uiimport (line 240)
[ctorPreviewText, ctorHeaderLines, ctorDelim] = ...
文件大小为 921MB,与我打开的其他文件相同。我也尝试使用 python 打开文件,但没有成功。有什么建议?我用的是 MATLAB R2013b。
更多信息:
文件是如何创建的:
%% acquisition of vibration data
% input:
% sample rate in Hz (max. 51200 Hz, should be used as bearing
% faults are high-frequent)
% time in seconds, stating the duration of the measurement
% (e.g. 600 seconds = 10 minutes)
% filename for the file to be saved
%
% examples:
% data = DAQ(51200, 600, 'NF1_1.mat');
% data = DAQ(51200, 600, 'NF1_2.mat');
function data = DAQ(samplerate,time,filename)
s = daq.createSession('ni'); % Creates the DAQ session
%%% Add the channels as accelerometer channels (meaning IEPE is turned on)
s.addAnalogInputChannel('cDAQ1Mod1','ai0','Accelerometer');
s.addAnalogInputChannel('cDAQ1Mod1','ai1','Accelerometer');
s.addAnalogInputChannel('cDAQ1Mod1','ai2','Accelerometer');
s.addAnalogInputChannel('cDAQ1Mod1','ai3','Accelerometer');
%s.addAnalogInputChannel('cDAQ1Mod2','ai0','Accelerometer');
s.Rate = samplerate;
s.NumberOfScans = samplerate*time;
%%% Defining the Sensitivities in V/g
s.Channels(1).Sensitivity = 0.09478; %31965, top outer
s.Channels(2).Sensitivity = 0.09531; %31966, back outer
s.Channels(3).Sensitivity = 0.09275; %31964, top inner
s.Channels(4).Sensitivity = 0.09363; %31963, back inner
data = s.startForeground(); %Acquiring the data
save(filename, 'data');
更多信息:
当我使用简单的文本编辑器打开文件时,我可以看到很多没有意义的字符,而且第一行也有:
MATLAB 5.0 MAT-FILE,平台:PCWIN64,创建于:4 月 30 日星期四 2015 年 16:29:07
更多信息: 文件本身:https://www.dropbox.com/s/r7mavil79j47xa2/GR_UB50n_1_2.mat?dl=0 它是 921MB。
编辑:
如何恢复我的数据?
【问题讨论】:
-
importdata!=load。对于 .mat 文件,您应该单独使用load。显然importdata在后台使用了这个。 -
好吧,我也试过加载,然后我收到一个简单的错误,说它无法打开文件。 (没有提供更多信息)
-
这个文件是从哪里来的?它实际上是一个
*.mat文件吗? -
我会将创建文件的脚本添加到问题中。它是一个 .mat 文件,我有许多其他文件由相同的脚本创建,它们确实有效。我认为该文件在某种程度上已损坏,但是文件大小还可以,所以我正在寻找一种方法来恢复我的数据。
-
用于保存这些文件的 MATLAB 版本是否与您使用的版本相同?这是唯一有问题的文件吗?
load(filename, '-mat')会发生什么?
标签: matlab