-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract_detectors.m
More file actions
34 lines (29 loc) · 1.25 KB
/
extract_detectors.m
File metadata and controls
34 lines (29 loc) · 1.25 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
function [detectorlist_minimal_array,NHEADERLINES] = extract_detectors(data, filename)
% This function makes a list of the detectors in use for a given run.
% This function was written by Thomas Rossi.
%Find the number of headerlines
for i=1:numel(data(:))
if strcmp(data{i},'')
elseif strcmp(data{i},'# Column Descriptions:')
firstdetector_index = i+1;
elseif data{i}(1)~='#'
NHEADERLINES=i-1;
disp(filename);
% disp(NHEADERLINES);
break;
else
end
end
% Use header lines to fetch detector names:
detectorlist_fullnames = data(firstdetector_index:NHEADERLINES-1);
detectorlist_split = cell([numel(detectorlist_fullnames) 1]);
for i=1:numel(detectorlist_fullnames)
detectorlist_split{i} = strsplit(detectorlist_fullnames{i},']');
detectorlist_minimal(i) = detectorlist_split{i,1}(2);
end
detectorlist_minimal_array = string(detectorlist_minimal);
% detectorlist_minimal_array = [];
% for i = 2:length(detectorlist_minimal)
% detectorlist_minimal_array(i)=detectorlist_minimal{i};
% end
end