Authored by Anthony Boyer

Labels which doesn't respect the <tag><number> logic are now explicitly excluded from pairing.

@@ -62,11 +62,17 @@ for i0=1:size(Filename,1) @@ -62,11 +62,17 @@ for i0=1:size(Filename,1)
62 bipole=[]; 62 bipole=[];
63 for i1=1:numel(Name) 63 for i1=1:numel(Name)
64 matched_1 = regexp(Name{i1},'^(?<label>.*?)(?<index>[0-9]+)$','once','names'); 64 matched_1 = regexp(Name{i1},'^(?<label>.*?)(?<index>[0-9]+)$','once','names');
  65 + if isempty(matched_1)
  66 + continue
  67 + end
65 label_name_1 = matched_1.label; 68 label_name_1 = matched_1.label;
66 label_number_1 = matched_1.index; 69 label_number_1 = matched_1.index;
67 matched_channels = 0; 70 matched_channels = 0;
68 for i2=1:numel(Name) 71 for i2=1:numel(Name)
69 matched_2 = regexp(Name{i2},'^(?<label>.*?)(?<index>[0-9]+)$','once','names'); 72 matched_2 = regexp(Name{i2},'^(?<label>.*?)(?<index>[0-9]+)$','once','names');
  73 + if isempty(matched_2)
  74 + continue
  75 + end
70 label_name_2 = matched_2.label; 76 label_name_2 = matched_2.label;
71 label_number_2 = matched_2.index; 77 label_number_2 = matched_2.index;
72 if strcmp(label_name_1,label_name_2) & str2num(label_number_1)+1 == str2num(label_number_2) & ~(sum(isnan(Position(i1,:))) > 0) & ~(sum(isnan(Position(i2,:))) > 0) 78 if strcmp(label_name_1,label_name_2) & str2num(label_number_1)+1 == str2num(label_number_2) & ~(sum(isnan(Position(i1,:))) > 0) & ~(sum(isnan(Position(i2,:))) > 0)