Authored by Anthony Boyer

Corrected a special case.

@@ -28,9 +28,9 @@ function ImaGIN_SpikesDetection(S) @@ -28,9 +28,9 @@ function ImaGIN_SpikesDetection(S)
28 %chan1_idx = indchannel(mono_stimulation_obj,mono_chans{1}{1}); 28 %chan1_idx = indchannel(mono_stimulation_obj,mono_chans{1}{1});
29 chan1_idx = find(strcmp(monopolar_sensors.label,mono_chans{1}{1})); 29 chan1_idx = find(strcmp(monopolar_sensors.label,mono_chans{1}{1}));
30 if numel(chan1_idx) == 0 30 if numel(chan1_idx) == 0
31 - old_name = mono_chans{1}{1};  
32 - match = regexp(old_name,'^(?<letters>[a-zA-Z]+)(?<digits>[0-9]+)$','once','names');  
33 - new_name = [match.letters '0' match.digits]; 31 + old_name = mono_chans{1}{1};
  32 + match = regexp(old_name,'^(?<label>.*?)(?<index>[0-9]+)$','once','names');
  33 + new_name = [match.label '0' match.index];
34 channels_map(cc).mono_chan1 = new_name; 34 channels_map(cc).mono_chan1 = new_name;
35 %chan1_idx = indchannel(mono_stimulation_obj,new_name); 35 %chan1_idx = indchannel(mono_stimulation_obj,new_name);
36 chan1_idx = find(strcmp(monopolar_sensors.label,new_name)); 36 chan1_idx = find(strcmp(monopolar_sensors.label,new_name));
@@ -39,8 +39,8 @@ function ImaGIN_SpikesDetection(S) @@ -39,8 +39,8 @@ function ImaGIN_SpikesDetection(S)
39 chan2_idx = find(strcmp(monopolar_sensors.label,mono_chans{1}{2})); 39 chan2_idx = find(strcmp(monopolar_sensors.label,mono_chans{1}{2}));
40 if numel(chan2_idx) == 0 40 if numel(chan2_idx) == 0
41 old_name = mono_chans{1}{2}; 41 old_name = mono_chans{1}{2};
42 - match = regexp(old_name,'^(?<letters>[a-zA-Z]+)(?<digits>[0-9]+)$','once','names');  
43 - new_name = [match.letters '0' match.digits]; 42 + match = regexp(old_name,'^(?<label>.*?)(?<index>[0-9]+)$','once','names');
  43 + new_name = [match.label '0' match.index];
44 channels_map(cc).mono_chan2 = new_name; 44 channels_map(cc).mono_chan2 = new_name;
45 %chan2_idx = indchannel(mono_stimulation_obj,new_name); 45 %chan2_idx = indchannel(mono_stimulation_obj,new_name);
46 chan2_idx = find(strcmp(monopolar_sensors.label,new_name)); 46 chan2_idx = find(strcmp(monopolar_sensors.label,new_name));