-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGetClusnames.m
42 lines (41 loc) · 1.44 KB
/
GetClusnames.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function clusnames = GetClusnames(input_args)
%GetClusnames Summary of this function goes here
% Detailed explanation goes here
if strcmp(input_args(end-2:end),'REX')
clusnames = {'1',' '};
else
global allspk_clus directory slash;
comments = false; % is there an "n" file with names and notes for the clusters?
if strcmp(input_args(1),'S')
fhandle = fopen([directory 'Sixx' slash 'Spike2Exports' slash input_args(1:end-4) 'n.txt']);
elseif strcmp(input_args(1),'R')
fhandle = fopen([directory 'Rigel' slash 'Spike2Exports' slash input_args(1:end-4) 'n.txt']);
elseif strcmp(input_args(1),'H')
fhandle = fopen([directory 'Hilda' slash 'Spike2Exports' slash input_args(1:end-4) 'n.txt']);
end
if fhandle ~= -1
comments = true;
end
if comments
clusidx = 1;
clusnames{clusidx} = fgetl(fhandle);
while ischar(clusnames{clusidx})
clusidx = clusidx+1;
clusnames{clusidx} = fgetl(fhandle);
end
clusnames{clusidx} = [];
fclose(fhandle);
else
nzent = []; % count non empty allspk_clus entries
for clusidx = 1:length(allspk_clus)
if nansum(nansum(allspk_clus{clusidx}))
nzent = [nzent clusidx];
end
end
clusnames = cell(1,length(nzent));
for clusidx = 1:length(nzent)
clusnames{clusidx} = num2str(nzent(clusidx));
end
end
end
end