Matlabwilliam hill官网
直播中

menxiaoer

3年用户 3经验值
私信 关注
[讨论]

matlab GUI的pushbutton2_Callback函数报错

代码如下:
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global method;
global p;
global L;
global framesize;
global inc;
global ccc;
global MusicNames;
global Click;
fs=44100;
recObj=audiorecorder(fs,16,1);
f=waitbar(0,'正在录音...');
recordblocking(recObj,10);
if isrecording(recObj)==0
waitbar(1,f,'录音完成!');
Click=Click+1;
pause(.5)
close(f)
else
opts=struct('WindowStyle','modal',...
'Interpreter','tex');
errordlg('\fontsize{10} 录音失败,请重试','Error',opts);
end
x=getaudiodata(recObj);
G=1.2;
x=x*G;
x_2=x-mean(x); %消除直流
%x_2=myVAD(x_2);
%x_2=v_specsub(x_2,fs); %谱减法
%sound(x_2,fs);
if method==1
[coeffs,delta,deltaDelta,~]=mfcc(x_2,fs,'WindowLength',framesize,'OverlapLength',inc,'NumCoeffs',L,'LogEnergy','Append');
ctest=[coeffs delta deltaDelta];
elseif method==2
ctest=mfcc_m(x_2,fs,p,L,framesize,inc);
else
ctest=v_melcepst(x_2,fs,'E0dD',L,p,framesize,inc);
end
for j=1:length(ccc)
%dist(j,1)=dtw_m(ctest,ccc{j});
dist(j,1)=dtw(ctest',ccc{j}');
end
[~,index]=min(dist);
set(handles.text10,'string',sprintf('测试结果%d:%s',Click,MusicNames{index}))
save('result.mat','index','dist','x_2','ctest')
微信图片_20231031190449.png

更多回帖

发帖
×
20
完善资料,
赚取积分