-
Notifications
You must be signed in to change notification settings - Fork 1
/
scanInfo.m
34 lines (29 loc) · 1.02 KB
/
scanInfo.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
% scanInfo()
% Mary Kate Montgomery
% February 2019
%
% Function to ID scan information from host directory
function [imageList, mNum, scanDate, fileType] = scanInfo(dirName, allScanDirs)
% Mouse ID
mNum = dirName;
% Update user
if exist('allScanDirs','var')
thisScanInd = find(strcmp(dirName,allScanDirs));
disp(['Analyzing scan # ' num2str(thisScanInd) ' of ' num2str(numel(allScanDirs))]);
else
disp(['Analyzing ' num2str(mNum)]);
end
% Scan Date
allFileStruct = dir(fullfile(dirName));
allFiles = cell(numel(allFileStruct),1);
for i = 1:numel(allFileStruct); allFiles{i} = allFileStruct(i).name; end
logName = allFiles{contains(allFiles,'.log')};
scanDate = pullScanDate(fullfile([dirName '\' logName]));
fileList = allFiles(contains(allFiles,'rec0'));
% Get File Type
fileTypeAll = cell(size(fileList)); for j = 1:numel(fileList); fileTypeAll{j} = fileList{j}(end-3:end); end
fileTypeAll = cell2mat(fileTypeAll);
fileType = mode(fileTypeAll);
% Take only image files
imageList = fileList(contains(fileList,fileType));
end