1 function X = load_traces(filename)
\r
3 % Load the traces from the file
\r
4 % Skip over the first line
\r
5 % For each subsequent line, load the observation and the name of the obs
\r
6 % Store this in X(i).obs and X(i).name
\r
10 % The first line gives the mapping of the identifiers
\r
11 % Load the mapping of the identifiers (index --> name)
\r
14 [t line] = strtok(line);
\r
15 [name index] = strread(t, '%s%d', 'delimiter', ':');
\r
16 X.varmap{index, 1} = char(name);
\r
17 if (size(line, 2) == 0), break, end;
\r
19 last = size(X.varmap, 1);
\r
20 X.varmap{last + 1, 1} = 'END';
\r
23 max_observations = 100;
\r
24 % Now keep reading pairs of lines until the end of the file
\r
27 if ~ischar(tline), break, end;
\r
28 obs = strread(tline);
\r
29 X.obs(index).obs = obs;
\r
30 if (size(obs, 2) > max_observations)
\r
31 X.obs(index).obs = obs(1:max_observations);
\r
34 assert(ischar(tline));
\r
35 X.obs(index).name = tline;
\r