我有一个巨大的波形矩阵:
[w,fs] = wavread('file.wav');
length(w)
ans =
258048
我想分段遍历这个矩阵(比如 50 个)并获得这些段的最大值以将其与另一个值进行比较。我试过这个:
thold = max(w) * .04;
nwindows = 50;
left = 1;
right = length(w)/nwindows;
counter = 0;
for i = 1:nwindows
temp = w(left:right);
if (max(temp) > thold)
counter = counter + 1;
end
left = right;
right = right+right;
end
但是 MATLAB 抛出了大量警告并给了我这个错误:
Index exceeds matrix dimensions.
Error in wlengthdur (line 17)
temp = w(left:right);
我是接近还是偏离路线?