A problem occur in code debugging
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hello..I have some same types of codes.But out of them some codes can be successfully debugged,while some codes show an error message and can't be successfully debugged.
%function main
clear all;
clc;
fid=fopen('coding670_r.bit');
speechin= fread(fid,'int16');
fclose(fid);
for i=1:length(speechin)
if speechin(i)==127
speechin(i)=0;
else if speechin(i)==129
speechin(i)=1;
end
end
end
tic
bitstream=enframe(speechin,82);
bitstream=(bitstream(:,3:end));
QuanJuValuedecode();
s=zeros(1,80);
speechout=[];
%tic
%/*----------------------------------------------------------------
-*
% * Main decoder routine *
%
*-----------------------------------------------------------------*
/
for i=1:size(bitstream,1)
a=dec2bin(bitstream(i,:));
a=a';
%C1 C2 P0 P1 P2 S1 S2
[L0,L1,L2,L3,P1,P0,S1,C1,GA1,GB1,P2,S2,C2,GA2,GB2]=destream(a);
[s,Az_dec,T2]=G729decode(L0,L1,L2,L3,P1,P0,S1,C1,GA1,GB1,P2,S2,C2,GA2,GB2);
%round(Az_dec*2^12)'
%T2
syn_pst=Post_Filter(s, Az_dec, T2); %/* Post-filter */
synth=Post_Process(syn_pst);
speechout=[speechout,synth];
end
toc
speechout=speechout/2^15;
wavwrite(speechout,'syn_speech670_r');
[ABSE,MSE,SNR,duration]=objectiveanalysis(speechin,speechout)
*Error:??? Attempted to access u1(201); index out of bounds because numel(u1)=200.*
0 个评论
回答(1 个)
Daniel Shub
2011-5-5
1 个投票
It doesn't appear you provided the relevant code. The error message refers to a variable u1, but I do not see a variable u1 in your code. You need to narrow down where the problem is. What line of code is causing the problem (the error message may tell you).
2 个评论
kuki
2011-5-6
Daniel Shub
2011-5-6
Then you need to evaluate each line in the code you posted one-by-one until you find the problem. Basically, cut and paste everything up to, but not including, the "main decoder routine." Does that cause the error? Once you find the error you should be able to cut out lots of the code and post a minimum example that shows the problem.
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!