Index Exceeds matrix dimensions error message in my Speech Segmentation code, would you help, please?
Show older comments
Hi, I am trying to segment a signal into its non-zero blocks. Below is the algorithm that I wrote to find the number of non-zero elements in each non-zero block of the signal. the vector Num is supposed to output these numbers. I get the error message: ??? Index exceeds matrix dimensions.
Error in ==> SegmentSignal at 56 if Numcount(j-1,1)==Numtimes
Please Help!
Thank you.
flags =(NormEnergySigX>0.05);
if flags(1)==0
k=0;
Num=[];
Numtimes=0;
Numcount=[];
for j=1:length(flags)
if (flags(Numtimes+1)==0)
Numtimes=0;
end
if flags(j)==0
Numtimes=Numtimes+1;
Numcount(j,1)=(flags(j)==0)*Numtimes;
end
if flags(j)==1
if Numcount(j-1,1)==Numtimes
k=k+1;
Num((Numcount(j-1,1)==Numtimes),k)=Numtimes;
if flags(Numtimes+1)==1
times=0;
if flags(j)==1
Numtimes=Numtimes+1;
Numcount(j,1)=(flags(j)==1)*Numtimes;
if Numcount(j-1,1)==Numtimes
Num((Numcount(j-1,1)==Numtimes),k)=Numtimes; % Num is supposed to contain the number of non-zero elements
% in each consecutive chunks of non-zero elements in flags.
end
end
end
end
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Audio Processing Algorithm Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!