forked from sgarrettroe/data_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrbLoadMetadata.m
57 lines (39 loc) · 1.23 KB
/
rbLoadMetadata.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
54
55
56
57
function s = rbLoadMetadata(s, filename) %basename, timestamp, pop_time, varargin)
phase_d = 0;
n_shots = 0;
n_scans = 0;
% open the file
fid = fopen(filename, 'r', 'ieee-le.l64', 'windows-932');
tline = fgetl(fid);
if strcmp(tline, 'mess2Dheterodyne_meta_format 1.1')
while ~feof(fid)
tline = fgetl(fid);
if strfind(tline, 'Phase')
phase = sscanf(tline,'Phase %f?');
s.phase = (phase)*pi/180;
end
if strfind(tline, 'Scan')
[temp, token] = strtok(tline, ' ');
[token, temp] = strtok(token, ' ');
% it prints the start time of the scan, but the last scan is
% aboprted.
s.n_scan = str2double(token)-1;
end
if strfind(tline, 'Shots')
[temp, token] = strtok(tline, ' ');
[token, temp] = strtok(token, ' ');
s.n_shots = str2double(token);
end
if strfind(tline, 'T3')
[temp, token] = strtok(tline, ' ');
[token, temp] = strtok(token, ' ');
s.t3 = str2double(token);
end
if strfind(tline, 'Comments')
[temp, token] = strtok(tline, ' ');
%[token, temp] = strtok(token, ' ');
s.comment = token;
end
end
end
fclose(fid);