-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetYearMonthDateCh.m
More file actions
49 lines (41 loc) · 1.63 KB
/
getYearMonthDateCh.m
File metadata and controls
49 lines (41 loc) · 1.63 KB
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
42
43
44
45
46
47
48
49
function [loadNames, years, months, dates, channels] = getYearMonthDateCh(animal, rootFolder)
%FIXME
foldersByYear = dir(rootFolder);%FIX
foldersByYear = foldersByYear(3:end);
foldersByYear = foldersByYear([foldersByYear.isdir]);
foldersByYear = foldersByYear((cellfun(@numel, {foldersByYear.name}) == 4));
YearNames = {foldersByYear.name};
foldersByMonth = dir(rootFolder);%FIX
foldersByMonth = foldersByMonth(3:end);
foldersByMonth = foldersByMonth([foldersByMonth.isdir]);
monthNames = {foldersByMonth.name};
dateNames = cell(1,length(monthNames));
for im = 1:length(monthNames)
foldersByDate = dir(fullfile(rootFolder, monthNames{im}));
foldersByDate = foldersByDate(3:end);
foldersByDate = foldersByDate([foldersByDate.isdir]);
dateNames{im} = {foldersByDate.name};
end
idata = 1;
loadNames = [];
months = [];
dates = [];
channels = [];
for im = 1:length(monthNames)
for id = 1:length(dateNames{im})
date = [monthNames{im} '/' dateNames{im}{id}];
loadFolder = fullfile(rootFolder, date, 'saved_oephysdata');
fileNames = {dir(fullfile(loadFolder, [animal '_oephysdata_*.mat'])).name};
for ich = 1:length(fileNames)
loadName = fullfile(loadFolder, fileNames{ich});
if exist(loadName, 'file')
loadNames{idata} = loadName;
months{idata} = monthNames{im};
dates{idata} = dateNames{im}{id};
chName_c = textscan(fileNames{ich}, [animal '_oephysdata_ch%d.mat']);
channels{idata} = chName_c{1};
idata = idata + 1;
end
end
end
end