我编了点程序,运行老是出错,不知道怎么回事。调试器提示在调用callback时出错,但是我又找不出,还望高手指点。程序如下:
fid=figure('menubar','none');
hread=uimenu(fid,'label','&read');
hsingle=uimenu(hread,'label','single read');
htwo=uimenu(hread,'label','two read','callback',['[FILENAME, PATHNAME, FILTERINDEX] = uigetfile(''*.wav'');'...
'if FILTERINDEX==1 [imp,Fs,bites]=wavread(FILENAME);P=fft(imp,65536),end',...
'p11=P(:,1);','p22=P(:,2);'...
'for i=1:16:65536 p1(i/16+15/16)=p11(i); p2(i/16+15/16)=p22(i); end ','H12=p2./p1;',...
'r1=(H12-HI)./(HR-H12).*exp(2*j*k*x1);','[max,n]=max(r1),','r=r1/(abs(r1(n)+1));',...
'a=1-abs(r).^2;','Zs=[(1+r)/(1-r)]*1.19*c0;']);
hplot=uimenu(fid,'label','&plot');
hr=uimenu(hplot,'label','plot |r|-f','callback','fid=plot(f,abs(r)),');
hphase=uimenu(hplot,'label','plot \chi-f','callback','hmani=plot(f,-j*log(r./abs(r)));')
x1=1.5;
s=0.5;
f=[0:24000/4096:24000*4095/4096];
c0=345;
d=0.2;
k2=0.0194*sqrt(f)/(c0*d);
k1=2*pi*f/c0;
k=k1-j*k2;
HI=exp(-j*k*s);
HR=exp(j*k*s);
错误信息:
??? Error: Missing operator, comma, or semicolon.
??? Error while evaluating uimenu Callback.
我截断了一些,发现:
加了下面这段就出问题:
'H12=p2./p1;',...
'r1=(H12-HI)./(HR-H12).*exp(2*j*k*x1);','[max,n]=max(r1),','r=r1/(abs(r1(n)+1));',...
'a=1-abs(r).^2;','Zs=[(1+r)/(1-r)]*1.19*c0;'
不加这段就是提示:
??? Error: "end" expected, "End of Input" found.
??? Error while evaluating uimenu Callback.
编程好难啊,老是出一点错就搞了半天。 |