Info

此问题已关闭。 请重新打开它进行编辑或回答。

Index exceeds matrix dimensions.,i keep on getting this error will anybody correct it 4 me?

1 次查看(过去 30 天)
[s Fs nb]=wavread('C:\Users\Thara\Desktop\PROJECT\DataIITKGP\speaker7\normal\7.normal.1.wav.split\000001one.wav');
y=resample(s,1,2);
Fs=Fs/2;
d=y./max(abs(y));
UvStartIdx=[127 2578 6082 7390 8848 12950 16196 ];
UvEndIdx=[1681 5205 6675 8194 12227 15301 19807];
PitchModFact=[1.03 1.01 1.02 1.03 1.01 1.05 1.03];
DurModFact=[0.78 0.7 0.75 0.84 0.71 0.9 0.82];
buf1=[];
b=[];
for i=1:7
[modres]=EpochProsodyModResidualModFn(y,Fs,PitchModFact(i),DurModFact(i));
size(modres)
buf1=[buf1;modres(UvStartIdx(i):UvEndIdx(i))'];
if i+1<=length(UvStartIdx)
buf1=[buf1;modres(UvEndIdx(i):UvStartIdx(i+1))'] ;
smtlb = sgolayfilt(modres(UvEndIdx(i):UvStartIdx(i+1))',3,41);
b=[b;smtlb];
figure;plot(smtlb);
sound(smtlb,Fs)
end
end
buf1=[buf1;modres(UvEndIdx(i):end)'];
  2 个评论
Walter Roberson
Walter Roberson 2013-7-1
It would help if you told us which line the problem was occurring on.
In your code, what do you expect to have happen if the file is not at least 19807 long ?
It is not clear to me that your code is taking into account the possibility that the file is multiple channels (stereo) ?
Sony
Sony 2013-7-2
编辑:Walter Roberson 2013-7-2
buf1=[buf1;modres(UvStartIdx(i):UvEndIdx(i))']; error is happening on this line
size(s)=40280
size(y)=20140
size(modres)= 1 16783

回答(2 个)

Matt J
Matt J 2013-7-1
It happens when you do things like this
>> a=1:7; a(8)
Index exceeds matrix dimensions.
Use DBSTOP to trap the error.

Walter Roberson
Walter Roberson 2013-7-2
You unconditionally try to access
modres(UvStartIdx(i):UvEndIdx(i))
for all "i" values possible for those two arrays. The maximum UvEndIdx value is 19807 so you are attempting to access up to index 19807 of modres(). However, your modres is not that long.
We have no information about your EpochProsodyModResidualModFn function, so we cannot tell you why your modres is coming out shorter than you expect.

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by