-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathea_detsidestr.m
More file actions
34 lines (30 loc) · 976 Bytes
/
ea_detsidestr.m
File metadata and controls
34 lines (30 loc) · 976 Bytes
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 [sidestr, side_ix, track] = ea_detsidestr(str)
% Small function to parse side inputs
% __________________________________________________________________________________
% Copyright (C) 2017 University of Pittsburgh, Brain Modulation Lab
%
% Ari Kappel
track = '';
str_parts = ea_strsplit(str, '_');
if length(str_parts) == 2
str = str_parts{2};
if (length(str_parts{1}) > 8) && strcmpi(str_parts{1}(1:8), 'keycheck')
track = str_parts{1}(9:end);
elseif (length(str_parts{1}) > 6) && strcmpi(str_parts{1}(1:6), 'toggle')
track = str_parts{1}(7:end);
elseif (length(str_parts{1}) > 3) && any(strcmpi(str_parts{1}(1:3), {'key', 'pos'}))
track = str_parts{1}(4:end);
end
end
side_ix = [];
sidestr={};
if strcmpi(str,'right')
side_ix = 1;
sidestr = {'right',''};
elseif strcmpi(str,'left')
side_ix = 2;
sidestr = {'','left'};
elseif strcmpi(str,'both')
side_ix = 1:2;
sidestr = {'right','left'};
end