MATLAB: Subscript indices must either be real positive integers or logicals.

[signal, Fs, bits_per_sample] = wavread('speech.wav');
T = 1/Fs; % Sampling period in seconds
L = length(signal); % Number of samples in the signal.

t = [0:(L-1)]*T; % Time vector in seconds
shows
Subscript indices must either be real positive integers or logicals.
Error in untitled4 (line 3)
L = length(signal); % Number of samples in the signal.

Best Answer

In windows command type
which length
what did you get?
I guess you get:
length is a variable