MATLAB: Because I have the error ¡Subscript indices must either be real positive integers or logicals!

subscript indices must either be real positive integers or logicals.

Hi I am making a program to get the average of voices stored in a database.
clear all;
clc;
Fs = 22050; % Frecuencia de Muestreo
[rec1] = wavread('F1b.wav');
[rec2] = wavread('F2b.wav');
[rec3] = wavread('F3b.wav');
[rec4] = wavread('F4b.wav');
[rec5] = wavread('F5b.wav');
prom=rec1;
tam = length(rec5);
fori = 1:1:tam
prom(i) = ((rec1(i)+rec2(i)+rec3(i)+rec4(i)+rec5(i))/5);
end;
lon = length(prom);
d = max(abs(prom));
prom = prom/d;
wavwrite(prom,Fs,16,'FProm.wav')
plot(prom)
sound(prom,Fs)
but when I compile throws the aforementioned mistake
thank you very much.

Best Answer

fori = 1:1:tam
is not a for loop: it is an assignment to a variable named fori