-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathchanlabels.m
63 lines (51 loc) · 1.85 KB
/
chanlabels.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
51
52
53
54
55
56
57
58
59
60
61
62
63
function res = chanlabels(this, varargin)
% Method for getting/setting the channel labels
% FORMAT res = chanlabels(this, ind, label)
%__________________________________________________________________________
% Vladimir Litvak
% Copyright (C) 2008-2022 Wellcome Centre for Human Neuroimaging
if this.montage.Mind == 0
if nargin == 3
ind = varargin{1};
label = varargin{2};
if iscell(label) && length(label)>1
if isnumeric(ind) && length(ind)~=length(label)
error('Indices and values do not match');
end
if length(label)>1
for i = 1:length(label)
for j = (i+1):length(label)
if strcmp(label{i}, label{j})
error('All labels must be different');
end
end
end
end
end
end
res = getset(this, 'channels', 'label', varargin{:});
else
% case with an online montage applied
if nargin == 3
ind = varargin{1};
label = varargin{2};
if iscell(label) && length(label)>1
if isnumeric(ind) && length(ind)~=length(label)
error('Indices and values do not match');
end
if length(label)>1
for i = 1:length(label)
for j = (i+1):length(label)
if strcmp(label{i}, label{j})
error('All labels must be different');
end
end
end
end
end
this.montage.M(this.montage.Mind) = getset(this.montage.M(this.montage.Mind), 'channels', 'label', varargin{:});
res = this;
else
res = getset(this.montage.M(this.montage.Mind), 'channels', 'label', varargin{:});
end
end