I am trying to read a WAV file in MATLAB and truncate it to 1 sec.
Here is the code I am trying right now, taken from:
http://www.mathworks.com/matlabcentral/answers/596-truncating-wav-files
[x,fs,k] = wavread(FileNames);
Y = x(n:n+fs-1, :);
This however gives me the following error:
Subscript indices must either be real positive integers or logicals.
Error in Test (line 13)
Y = x(n:n+fs-1, :);
How can I fix this and how I can do the truncation?