-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpspm_get_marker.m
50 lines (46 loc) · 1.5 KB
/
pspm_get_marker.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
40
41
42
43
44
45
46
47
48
49
50
function [sts, data] = pspm_get_marker(import)
% ● Description
% pspm_get_marker gets the marker channel for different data types
% ● Format
% [sts, data] = pspm_get_marker(import)
% ● Arguments
% ┌─────import: import job structure
% ├──────.data: mandatory
% ├────.marker: mandatory, string
% │ accepted values: 'timestamps' or 'continuous'
% ├────────.sr: mandatory, double
% │ timestamps: timeunits in seconds
% │ continuous: sample rate in 1/seconds)
% ├─────.flank: optional, string, applicable for continuous channels only
% │ accepted values: 'ascending', 'descending', 'both'
% │ default: 'both'
% └.markerinfo: optional, struct, returns marker timestamps in seconds
% ├────.name:
% └───.value:
% ● History
% Introduced in PsPM version.
% Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
% Maintained in 2022 by Teddy Chao (UCL)
%% 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 marker info
if isfield(import, 'markerinfo')
data.markerinfo = import.markerinfo;
end
%% add header
data.header.chantype = 'marker';
data.header.units = 'events';
data.header.sr = 1;
sts = 1;
return