@@ -54,7 +54,6 @@ function PreprocessSpikes(basepath, varargin)
5454prePhy = p .Results.prePhy;
5555datFolder = p .Results.datFolder;
5656spikeLabels = p .Results.spikeLabels; % spike labels is causing issues even when no bad channels are noted - Heathlarsson 05/29/23
57-
5857%% 1- extract spike times and waveforms for sorted clusters
5958cd(basepath );
6059basename = basenameFromBasepath(pwd );
@@ -72,8 +71,13 @@ function PreprocessSpikes(basepath, varargin)
7271end
7372
7473if isfield(session.spikeSorting{1 , 1 }, ' relativePath' ) && exist(session.spikeSorting{1 , 1 }.relativePath, ' dir' )
75- f.name = session.spikeSorting{: }.relativePath;
76- f.folder = basepath ;
74+ f = struct();
75+ for sorting_i = 1 : length(session .spikeSorting)
76+ f(sorting_i ).name = session.spikeSorting{sorting_i }.relativePath;
77+ f(sorting_i ).folder = basepath ;
78+ end
79+ % transpose to work with current uses of size
80+ f = f ' ;
7781else
7882 f = dir(' Kilosort*' );
7983 if (size(f , 1 ) ~= 1 ) && (~multiKilosort )
@@ -87,9 +91,6 @@ function PreprocessSpikes(basepath, varargin)
8791% Make sure there is only one KiloSort folder before running, unless you
8892% needed to spike sort probes separately (multiKilosort=1).
8993
90- % The hippocampal KiloSort folder should be listed first in the session
91- % folder for organization, but this is not necessary for running
92-
9394% check if spikes.cellinfo has already been created
9495pre_exist_spike_files = dir(' *spikes*.cellinfo.mat' );
9596if (size(f , 1 ) > 1 ) && multiKilosort
@@ -173,7 +174,6 @@ function PreprocessSpikes(basepath, varargin)
173174 ' labelsToRead' , spikeLabels );
174175 end
175176end
176-
177177%% 2 - compute basic cell metrics
178178if exist([basepath , filesep , ' anatomical_map.csv' ], ' file' )
179179 channel_mapping ;
@@ -206,6 +206,6 @@ function PreprocessSpikes(basepath, varargin)
206206
207207% GUI to manually curate cell classification
208208if showCellMet
209- cell_metrics = CellExplorer(' metrics' , cell_metrics );
209+ CellExplorer(' metrics' , cell_metrics );
210+ end
210211end
211- end
0 commit comments