Skip to content
Snippets Groups Projects
Commit c6c45ff8 authored by Markus Mueller-Trapet's avatar Markus Mueller-Trapet
Browse files

bugfix related to zeros at beginning and end

parent 1b663fd0
No related branches found
No related tags found
No related merge requests found
......@@ -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) = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment