-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetDataFileName.m
More file actions
executable file
·45 lines (37 loc) · 1.54 KB
/
getDataFileName.m
File metadata and controls
executable file
·45 lines (37 loc) · 1.54 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
%%
% [fullFileName, path] = getDataFileName(prefixCode, expNum)
%
% Returns the path and the path\fileName in which to store data. Format is:
%
% path: \dataDirectory\prefixCode\expNum\YYMMDD\flyNum\flyExpNum\
% filename: prefixCode_expNum_YYMMDD_flyNum_flyExpNum_nextSequentialNumber.mat
%
%
% JSB 3\22\2013
%%
function [fullFileName, path, trialNum, idString] = getDataFileName(exptInfo)
prefixCode = exptInfo.prefixCode;
expNum = exptInfo.expNum;
flyNum = exptInfo.flyNum;
cellNum = exptInfo.cellNum;
cellExpNum = exptInfo.cellExpNum;
ephysSettings; % Loads settings
% Make numbers strings
eNum = num2str(expNum,'%03d');
fNum = num2str(flyNum,'%03d');
cNum = num2str(cellNum,'%03d');
cENum = num2str(cellExpNum,'%03d');
% Put together path name and fileNamePreamble
path = [dataDirectory,prefixCode,'\expNum',eNum,...
'\flyNum',fNum,'\cellNum',cNum,'\','cellExpNum',cENum,'\'];
fileNamePreamble = [prefixCode,'_expNum',eNum,...
'_flyNum',fNum,'_cellNum',cNum,'_cellExpNum',cENum,'_trial'];
idString = [prefixCode,'_expNum',eNum,...
'_flyNum',fNum,'_cellNum',cNum,'_cellExpNum',cENum,'_'];
% Determine trial number
trialNum = 1;
while( size(dir([path,fileNamePreamble,num2str(trialNum,'%03d'),'.mat']),1) > 0)
trialNum = trialNum + 1;
end
% Put together full file name
fullFileName = [path,fileNamePreamble,num2str(trialNum,'%03d'),'.mat'];