回 帖 发 新 帖 刷新版面

主题:[讨论]matlab 数值文件输出

我用matlab读取一个wav文件,并对其data的栏位进行转换float->int16,并用想要输出成txt文件,但是其输出的资料都会是乱码,希望各位高手能指点一下
我的程序如下

fileName='merger3(A+B-C).wav';
[y, fs, nbits]=wavread(fileName);
y0=y*(2^16/2);
y1=int16(y0);
save test.txt y1

回复列表 (共3个回复)

沙发

用fprintf函数可以拉,save只能保存为mat格式

板凳

因为我要做别的处理,所以必须把数值写到文件去,不知道有其他解决方法吗?

3 楼

fileName='bluetooth_input.wav';
[y, fs, nbits]=wavread(fileName);
y0=y*(2^16/2);
y1=int16(y0);
LogFID=fopen('test.txt' ,'a');
fprintf(LogFID,'%d ',y1);
fclose(LogFID);

我来回复

您尚未登录,请登录后再回复。点此登录或注册