Authored by Anthony Boyer

Fix for when the sampling frequency is not an integer.

@@ -194,9 +194,9 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor @@ -194,9 +194,9 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor
194 new_sensors_info.type = 'ctf'; 194 new_sensors_info.type = 'ctf';
195 new_sensors_info.unit = 'mm'; 195 new_sensors_info.unit = 'mm';
196 196
197 - % Create the new files  
198 - file_header = fullfile(path_out,['monopolar_baseline_' num2str(srate) 'Hz.mat']);  
199 - file_data = fullfile(path_out,['monopolar_baseline_' num2str(srate) 'Hz.dat']); 197 + % Create the new files
  198 + file_header = fullfile(path_out,['monopolar_baseline_' num2str(round(srate)) 'Hz.mat']);
  199 + file_data = fullfile(path_out,['monopolar_baseline_' num2str(round(srate)) 'Hz.dat']);
200 if exist(file_header, 'file') == 2 200 if exist(file_header, 'file') == 2
201 delete(file_header); 201 delete(file_header);
202 end 202 end
@@ -206,10 +206,10 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor @@ -206,10 +206,10 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor
206 206
207 % Create the new object 207 % Create the new object
208 D = meeg(size(timeseries,1),size(timeseries,2),1); 208 D = meeg(size(timeseries,1),size(timeseries,2),1);
209 - D = fname(D,['monopolar_baseline_' num2str(srate) 'Hz']); 209 + D = fname(D,['monopolar_baseline_' num2str(round(srate)) 'Hz']);
210 D = path(D,path_out); 210 D = path(D,path_out);
211 D = fsample(D,srate); 211 D = fsample(D,srate);
212 - D = sensors(D,'EEG',new_sensors_info) 212 + D = sensors(D,'EEG',new_sensors_info);
213 D = blank(D) ; 213 D = blank(D) ;
214 D = link(D,file_data); 214 D = link(D,file_data);
215 D(:,:,1) = timeseries; 215 D(:,:,1) = timeseries;
@@ -217,7 +217,7 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor @@ -217,7 +217,7 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor
217 217
218 %% Compute bipolar montage on baseline object to get the bipolar baseline object 218 %% Compute bipolar montage on baseline object to get the bipolar baseline object
219 Sbp.Fname = file_header; 219 Sbp.Fname = file_header;
220 - Sbp.FileOut = fullfile(path_out,['bipolar_baseline_' num2str(srate) 'Hz']); 220 + Sbp.FileOut = fullfile(path_out,['bipolar_baseline_' num2str(round(srate)) 'Hz']);
221 bp_baseline_obj = ImaGIN_BipolarMontage(Sbp); 221 bp_baseline_obj = ImaGIN_BipolarMontage(Sbp);
222 global_mapping = monopolar_to_bipolar_mapping(Sbp.Fname,path_out); 222 global_mapping = monopolar_to_bipolar_mapping(Sbp.Fname,path_out);
223 223
@@ -256,7 +256,7 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor @@ -256,7 +256,7 @@ function rates_table = spikes_from_monopolar(srate,labels,timeseries,zeroed,coor
256 spkFile.spikeRate = rates_table; 256 spkFile.spikeRate = rates_table;
257 spkFile.markers = spks_table; 257 spkFile.markers = spks_table;
258 spkFile.baseline = ['Total duration of ' num2str((nsamples(bp_baseline_obj)/fsample(bp_baseline_obj))/60) ' minutes']; 258 spkFile.baseline = ['Total duration of ' num2str((nsamples(bp_baseline_obj)/fsample(bp_baseline_obj))/60) ' minutes'];
259 - spkFile.comment = 'Spike rate is number of spikes per minute whithin a bipolar channel'; 259 + spkFile.comment = 'Spike rate is the number of spikes per minute for each bipolar channel';
260 results_file = fullfile(path_out,spkFileName); 260 results_file = fullfile(path_out,spkFileName);
261 save(results_file, 'spkFile'); 261 save(results_file, 'spkFile');
262 end 262 end