function f = block(v, N, M) % This function separates the vector % into blocks. Each block has size N. % and consecutive blocks differ in % their starting positions by M % % Typically % N = 30 msec (600 samples) % M = 10 msec (200 samples) n = length(v); maxblockstart = n - N + 1; lastblockstart = maxblockstart - mod(maxblockstart-1 , M); % Remove the semicolon to see the number of blocks % numblocks = (lastblockstart-1)/M + 1 numblocks = (lastblockstart-1)/M + 1; f = zeros(numblocks,N); for i = 1:numblocks for j = 1:N f(i,j) = v((i-1)*M+j); end end