diff --git a/io/bz_GetSpikes.m b/io/bz_GetSpikes.m index 0902c6f7..501ca0f7 100644 --- a/io/bz_GetSpikes.m +++ b/io/bz_GetSpikes.m @@ -167,7 +167,11 @@ fold_idx = find(cellfun(@(x) ~isempty(x),aux)); %in case of multiple folders, it's going to take the first one in the %list - kilosort_path = temp(fold_idx(1)); + if ~isempty(fold_idx) + kilosort_path = temp(fold_idx(1)); + else + kilosort_path = []; + end if strcmpi(sortingMethod,'clu') || ~isempty(cluFiles) % LOADING FROM CLU/ RES fs = spikes.samplingRate;