Authored by Anthony Boyer

Now removing underscores from channel labels in .mat files.

@@ -133,7 +133,7 @@ for i0 = 1:size(t,1) @@ -133,7 +133,7 @@ for i0 = 1:size(t,1)
133 % Loop on all channels available in the file 133 % Loop on all channels available in the file
134 for i1 = 1:length(Sensors.label) 134 for i1 = 1:length(Sensors.label)
135 sensLtmp = Sensors.label{i1}; 135 sensLtmp = Sensors.label{i1};
136 - sensLtmp(ismember(double(sensLtmp),[',' ';' '-'])) =''; 136 + sensLtmp(ismember(double(sensLtmp),[',' ';' '-' '_'])) ='';
137 Sensors.label{i1} = sensLtmp; 137 Sensors.label{i1} = sensLtmp;
138 iChanPos = findChannel(Sensors.label{i1}, Name, 'all_upper'); 138 iChanPos = findChannel(Sensors.label{i1}, Name, 'all_upper');
139 % If the channel was already found in the list before: check the best option based on the case 139 % If the channel was already found in the list before: check the best option based on the case
@@ -225,7 +225,7 @@ for i0 = 1:size(t,1) @@ -225,7 +225,7 @@ for i0 = 1:size(t,1)
225 % Replace labels in D.channels 225 % Replace labels in D.channels
226 for iChan = 1:length(SpmMat.D.channels) 226 for iChan = 1:length(SpmMat.D.channels)
227 spmLtmp = SpmMat.D.channels(iChan).label; 227 spmLtmp = SpmMat.D.channels(iChan).label;
228 - spmLtmp(ismember(double(spmLtmp),[',' ';' '-'])) =''; 228 + spmLtmp(ismember(double(spmLtmp),[',' ';' '-' '_'])) ='';
229 SpmMat.D.channels(iChan).label = spmLtmp; 229 SpmMat.D.channels(iChan).label = spmLtmp;
230 230
231 iChanMatch = find(strcmpi(SpmMat.D.channels(iChan).label, chMatchLog(:,1))); 231 iChanMatch = find(strcmpi(SpmMat.D.channels(iChan).label, chMatchLog(:,1)));
@@ -310,7 +310,10 @@ for i0 = 1:size(t,1) @@ -310,7 +310,10 @@ for i0 = 1:size(t,1)
310 if (length(iChanMatch1) == 1) && (length(iChanMatch2) == 1) 310 if (length(iChanMatch1) == 1) && (length(iChanMatch2) == 1)
311 SpmMat.D.trials.events(iEvt).type = noteNameNew; 311 SpmMat.D.trials.events(iEvt).type = noteNameNew;
312 end 312 end
313 - end 313 + end
  314 + if ~(exist('csv_all_electrodes','var') == 1)
  315 + error('Could not match notes with channels found in the implantation file.')
  316 + end
314 csv_struct.csv_labels = csv_all_electrodes(:,1); 317 csv_struct.csv_labels = csv_all_electrodes(:,1);
315 SpmMat.D.other = csv_struct; % Add an extra field to the .mat so we have a listing of all channel labels in the csv. 318 SpmMat.D.other = csv_struct; % Add an extra field to the .mat so we have a listing of all channel labels in the csv.
316 % Update existing .mat file 319 % Update existing .mat file