forked from technogeeky/MapSatAltitude
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparseScannerInfo.m
More file actions
32 lines (29 loc) · 860 Bytes
/
parseScannerInfo.m
File metadata and controls
32 lines (29 loc) · 860 Bytes
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
function Scanners = parseScannerInfo(filename)
if nargin < 1
fid = fopen('scanners.txt');
else
fid = fopen(filename);
end
headerline = fgetl(fid);
% format is: Name FOV HalfFOV AltMin AltIdeal AltMax LongName
C = textscan(fid, '%s %f %f %f %f %f %s','Delimiter','\b\r\n\t','MultipleDelimsAsOne',1,'CommentStyle','%');
% ^^^ this lets us put comments in the files
% ^^ this combines all tabs into one delimiter,
% so the data file can look nice
% ^ this removes ' ' from being a valid delimiter
% so that strings with spaces can be sucked up by %s
h = strread(headerline,'%s');
fclose(fid);
for i = 1:length(C{1})
for j = 1:length(h)
field = h{j};
if iscell(C{j})
fieldVal = C{j}{i};
else
fieldVal = C{j}(i);
end
P.(field)=fieldVal;
end
Scanners(i)=P;
end
end