简体   繁体   English

在matlab中加载文件.dat时出错

[英]Error when load file .dat in matlab

I have problem when I try to load file .dat in Matlab. 当我尝试在Matlab中加载文件.dat时遇到问题。 My file .dat about speech data: 我的文件.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

There is a error: 有一个错误:

??? ??? Error using ==> load Number of columns on line 1 of ASCII file C:\\Program Files\\MATLAB\\R2010b\\bin\\doan\\y.dat 使用==>加载时出错使用ASCII文件C行第1行的列数:\\ Program Files \\ MATLAB \\ R2010b \\ bin \\ doan \\ y.dat
must be the same as previous lines. 必须与之前的行相同。
Error in ==> twosubband at 8 load y.dat; 错误==> twosubband at 8 load y.dat; % Load speech data %加载语音数据

I don't understand. 我不明白。 Help me fix it. 帮我解决一下

load expects a file in its own data format. load期望文件采用自己的数据格式。 Try saving y as y.mat instead of y.dat . 尝试将y保存为y.mat而不是y.dat That is, replace y.dat in both the line where you save and the line where you load by y.mat . 也就是说,取代y.dat在两种情况您保存订单并在您通过加载线y.mat

That should do the trick. 这应该够了吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM