MATLAB: Real cepstrum in loop

cepstrumloopMATLABrceps

Hi
I have to compute a real cepstrum of .wav signal taking 20ms parts of signal, skip 5ms. Next I have to plot this in 3D using imagesc and mesh. My problem is in loop when I run rceps function.
My code is
[x,fp]=wavread('name_of_file.wav');
dr=4; %decimation level
fd=fp/dr;
y=decimate(x,dr);
Nd=length(y); %length of decimated signal
t=0:1/fd:(Nd-1)/fd;
next
d=floor(( ( ( ( (Nd-1) /fd) *1000) -20) /5)); %number of 20ms parts with skip
5ms
for i=0:1:d
g=y( ( ( ( ((i*5) +1) /1000) *fd):( ( ( ((i*5) +21) /1000) *fd) );
%g=y(((i*60)+1):((i*60)+240)); %another method of cutting signal
tab(i+1)=rceps(g);
end
After running this code I see an error
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> my_file at 38
tab(i)=rceps(g);
rceps function return real cepstrum of signal. Length of returning signal is the same as argument signal (in my case 20ms, 240 points).
I don't have enough experience to solve this problem, because this is my first time when I use loop in MATLAB and I don't know how to do this correctly.
Thank you for your time
Dawid

Best Answer

Solution
tab=[];
for i=0:1:d-1
g=y(((i*60)+1):((i*60)+241));
c=rceps(g);
p=c';
tab=[tab; p];
end
Dawid