Skip to content

Commit

Permalink
SEEG channel name parsing: include shared first digit in group name
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed Jan 6, 2023
1 parent 710bf65 commit 5722fb4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions toolbox/gui/panel_montage.m
Expand Up @@ -22,7 +22,7 @@
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2009-2019
% Authors: Francois Tadel, 2009-2023

eval(macro_method);
end
Expand Down Expand Up @@ -2053,11 +2053,20 @@ function SaveMontageFile(sMontages, FileName, FileFormat)
if ~isempty(iInd)
% Get unique tags
uniqueTags = unique(AllTags(iInd));
% Check for each of them: if 11 is the first index, include the first digit in the group name
% Check for each of them: if all the indices start with the same digit, include the first digit in the group name
for iTag = 1:length(uniqueTags)
iChTag = find(strcmpi(AllTags(iInd), uniqueTags{iTag}));
chInd = cellfun(@str2num, AllInd(iInd(iChTag)));
if all(chInd >= 10) && all(chInd <= 49) && (length(chInd) > 4)
if (length(chInd) > 4) && ...
(all(((chInd >= 11) & (chInd <= 19)) | ((chInd >= 100) & (chInd <= 199))) || ...
all(((chInd >= 21) & (chInd <= 29)) | ((chInd >= 200) & (chInd <= 299))) || ...
all(((chInd >= 31) & (chInd <= 39)) | ((chInd >= 300) & (chInd <= 399))) || ...
all(((chInd >= 41) & (chInd <= 49)) | ((chInd >= 400) & (chInd <= 499))) || ...
all(((chInd >= 51) & (chInd <= 59)) | ((chInd >= 500) & (chInd <= 599))) || ...
all(((chInd >= 61) & (chInd <= 69)) | ((chInd >= 600) & (chInd <= 699))) || ...
all(((chInd >= 71) & (chInd <= 79)) | ((chInd >= 700) & (chInd <= 799))) || ...
all(((chInd >= 81) & (chInd <= 89)) | ((chInd >= 800) & (chInd <= 899))) || ...
all(((chInd >= 91) & (chInd <= 99)) | ((chInd >= 900) & (chInd <= 999))))
for i = iInd(iChTag)
AllTags{i} = [AllTags{i}, AllInd{i}(1)];
AllInd{i} = AllInd{i}(2:end);
Expand Down

0 comments on commit 5722fb4

Please sign in to comment.