-
Notifications
You must be signed in to change notification settings - Fork 12
/
buildLabelFiles.m
53 lines (44 loc) · 1.27 KB
/
buildLabelFiles.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
42
43
44
45
46
47
48
49
50
51
52
53
function [zFD, zID,fNameList]= buildLabelFiles(matchingFile, p)
% buildLabelFiles.m
% Takes file name and directory and creates FD and ID files
% Inputs:
%
% matchingFile - TPWS file name
%
% sdir - Directory path containing TPWS files
%
%
%
% Outputs:
%
% zFD - Inicialize variable of detection times to label as false detections
%
% zID - Inicialize variable of detection times to label as ID detections
%
% fNameList - A struct with 3 fields indicating the directory path to
% FD,TD and ID files
zFD = [];
zID = [];
% Name and build false detection file
ffn = strrep(matchingFile,'TPWS','FD');
fNameList.FD = fullfile(p.tpwsDir,ffn);
AFD = exist(fNameList.FD,'file');
if (AFD ~= 2) % if it doesn't exist, make it
zFD(1,1) = 1;
save(fNameList.FD,'zFD');
disp('Made new FD file');
end
% Name true detection file
tfn = strrep(matchingFile,'TPWS','TD');
fNameList.TD = fullfile(p.tpwsDir,tfn);
% NOTE: TD file is made elsewhere because it depends on a later variable
% Name and build ID file
idfn = strrep(matchingFile,'TPWS','ID');
fNameList.ID = fullfile(p.tpwsDir,idfn);
AID = exist(fNameList.ID,'file');
if (AID ~= 2)% if it doesn't exist, make it
zID = [];
mySpID = p.mySpID;
save(fNameList.ID,'zID','mySpID');
disp('Made new ID file');
end