Commit c6c45ff8 authored by Markus Mueller-Trapet's avatar Markus Mueller-Trapet

bugfix related to zeros at beginning and end

parent 1b663fd0
......@@ -32,16 +32,16 @@ else
nOverlap = round(sArgs.overlap);
end
nSegments = ceil(a.nSamples / (nWindow - nOverlap)) + 1;
nNewLength = (nSegments - 1) * (nWindow - nOverlap) + nWindow;
if nNewLength-nWindow > a.nSamples
a = ita_extend_dat(a,nNewLength - nWindow,'forcesamples');
end
% half a window length at beginning and end
ext_zeros = zeros(nWindow/2,a.nChannels);
data = [ext_zeros; a.time; ext_zeros];
nSegments = ceil((size(data,1) - nWindow) / (nWindow - nOverlap)) + 1;
nNewLength = (nSegments - 1) * (nWindow - nOverlap) + nWindow;
if nNewLength > a.nSamples
a = ita_extend_dat(a,nNewLength,'forcesamples');
end
%% generate window
win_vec = window(sArgs.window,nWindow+1);
win_vec(end) = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment