matlab实验识别拨号音,求助 有关GUI 电话拨号音合成与识别问题

本帖最后由 可怜小白 于 2020-5-9 13:53 编辑

我想在GUI里用uigetfile打开音频文件,然后在“xuanzedakai”里显示文件名,然后分析后在“shibiejieguo”显示结果。可是程序运行后shibiejieguo没有显示,程序报错:无法执行赋值,因为左侧和右侧的元素数目不同。求大佬指教问题出在哪?

如果可以也请指教一下这样分析音频对不对。谢谢!

接触matlab的第四天,小白中的小白,有些基础问题还不是很明白。求各位稍微耐心一点,救救孩子

以下是代码:

function shibie_Callback(hObject, eventdata, handles)

% hObject    handle to shibiejieguo (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

[FileName,PathName]=uigetfile('*.m4a','选择分析的音频');

file=[PathName,FileName];

tt=strcat(get(handles.xuanzedakai,'String'),FileName);

set(handles.xuanzedakai,'String',tt);

[y,fs]=audioread(file);

sound(y,fs);

counter=length(handles.numsig)/820;

for i=1:counter

f=fft(handles.numsig((i-1)*820+1:1*410),8192);

a=abs(f);

p=a.*a/8192;

num(1)=find(p(1:1000)==max(p(1:1000)));

num(2)=1000+find(p(1000:1700)==max(p(1000:1700)));

if(num(1)<730)

row=1;

elseif(num(1)<810)

row=2;

elseif(num(1)<900)

row=3;

else

row=4;

end

if(num(2)<1300)

col=1;

elseif(num(2)<1400)

col=2;

else

col=3;

end

if((row==1)&&(col==1))

newnum=strcat(get(handles.shibiejieguo,'String'),'1');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==1)&&(col==2))

newnum=strcat(get(handles.shibiejieguo,'String'),'2');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==1)&&(col==3))

newnum=strcat(get(handles.shibiejieguo,'String'),'3');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==2)&&(col==1))

newnum=strcat(get(handles.shibiejieguo,'String'),'4');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==2)&&(col==2))

newnum=strcat(get(handles.shibiejieguo,'String'),'5');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==2)&&(col==3))

newnum=strcat(get(handles.shibiejieguo,'String'),'6');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==3)&&(col==1))

newnum=strcat(get(handles.shibiejieguo,'String'),'7');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==3)&&(col==2))

newnum=strcat(get(handles.shibiejieguo,'String'),'8');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==3)&&(col==3))

newnum=strcat(get(handles.shibiejieguo,'String'),'9');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

elseif((row==4)&&(col==2))

newnum=strcat(get(handles.shibiejieguo,'String'),'0');

set(handles.shibiejieguo,'String',newnum);guidata(hObject,handles);

end

end

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值