]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Preprocess only files that exist, don't fail on missing file
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Jan 2014 09:16:41 +0000 (10:16 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Jan 2014 09:16:41 +0000 (10:16 +0100)
ugw/data/preprocess.m

index a43578d3a999b257fd1c73f91147a4220dce9030..ef729fd7e420989a6b0948b62656094254c82c58 100755 (executable)
@@ -22,16 +22,22 @@ quantiles = [0 0.5 0.90 0.99];
 mat = zeros(0, length(quantiles) + 2);
 names = {};
 
-for i=1:length(argv),
+for i=1:length(datafiles),
   [d, n, e, v] = fileparts(datafiles{i});
-  x = load(datafiles{i})*1e6;
-  stat = csv2cell([n, "-stat.txt"], '=');
-  lost = stat{6,2};
-  q = quantile (x, quantiles);
-  q = max(q, 0)';
-  avg = mean(x);
+  try
+    x = load(datafiles{i})*1e6;
+    stat = csv2cell([n, "-stat.txt"], '=');
+    lost = stat{6,2};
+    q = quantile (x, quantiles);
+    q = max(q, 0)';
+    avg = mean(x);
+  catch
+    disp(["Skiping ", n]);
+    continue
+  end_try_catch
   mat = [ mat; q lost avg ];
-  names{i} = n;
+  names{length(names)+1} = n;
+  disp(["Added ", n]);
 end
 
 if 0,