-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpspm_get_hb.m
39 lines (36 loc) · 1.17 KB
/
pspm_get_hb.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
35
36
37
38
39
function [sts, data]=pspm_get_hb(import)
% ● Description
% pspm_get_hb is a common function for importing heart beat data
% ● Format
% [sts, data]= pspm_get_hb(import)
% ● Arguments
% import: import job structure with mandatory fields
% .data
% .marker ('timestamps', 'continuous')
% .sr (timestamps: timeunits in seconds, continuous: sample rate in 1/seconds)
% and optional fields
% .flank ('ascending', 'descending', 'both': optional field for
% continuous channels; default: both)
% ● History
% Introduced in PsPM 3.0
% Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
%% Initialise
global settings
if isempty(settings)
pspm_init;
end
sts = -1;
% get data
% -------------------------------------------------------------------------
[bsts, import] = pspm_get_events(import);
if bsts~=1
warning('ID:invalid_input', 'Call of pspm_get_events failed.'); return;
end
data.data = import.data;
% add header
% -------------------------------------------------------------------------
data.header.chantype = 'hb';
data.header.units = 'events';
data.header.sr = 1;
sts = 1;
return