-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateNewWindow.m
35 lines (33 loc) · 1.15 KB
/
createNewWindow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function [signalWindow, annType, signalAnns] = ...
createNewWindow(annotationData, sig, central, windowSize)
%CREATENEWWINDOW get the slice of the signal
%with size determinated by a windowSize and centered
%by the central.
%
% [signalWindow, annType, signalAnns] = createNewWindow(annotationData, sig, index, windowSize)
%
% PARAMETERS:
% annotationData - struct with the metadatas of the signal.
%
% sig - array with the whole signal.
%
% central - integer represents the signal position
% which will be the central of the window.
%
% windowSize - integer with the number of positions
% get from both sides in relation to the center.
%
% RETURN:
% signalWindow - array with the slice of sig with
% lenght equals to 2*windowSize
%
% annType - character with the annotation of the center
% R-wave of the window.
%
% signalAnns - chasracters array with the R-wave
% annotations from all the window signal.
window = (-windowSize:windowSize -1) + central;
% Get data
[annType, signalAnns] = getWindowAnns(annotationData, central,windowSize);
signalWindow = sig(window, 1);
end