2013-04-24 99 views
0

我嘗試在Matlab中加載文件.dat時遇到問題。 我的文件.DAT約語音數據:當在Matlab中加載文件.dat時出現錯誤

% Read data file "orig.dat" with sampling rate of 8 kHz 
% create an example sound 
fs=8000; 
t=0:1/fs:3; 
x = 1*sin(2*pi*4*t)+0.25* sin(2*pi*560*t); 
% play it back 
%sound(x, 8000); 
wavwrite(x,fs,16,'test56.wav'); 
y=wavread('test56.wav') 
save y.dat y 
load y.dat 

有一個錯誤:

??? Error using ==> load Number of columns on line 1 of ASCII file C:\Program Files\MATLAB\R2010b\bin\doan\y.dat
must be the same as previous lines.
Error in ==> twosubband at 8 load y.dat; % Load speech data

我不明白。 幫我修復它。

回答

2

load需要一個具有自己數據格式的文件。嘗試保存y作爲y.mat而不是y.dat。 也就是說,在您保存的行和您加載的行中均替換爲y.daty.mat

這應該做的伎倆。