From 18fae62183b4e5e8caeae62fc413df79fd44edce Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 20 Jan 2014 10:16:41 +0100 Subject: [PATCH] Preprocess only files that exist, don't fail on missing file --- ugw/data/preprocess.m | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ugw/data/preprocess.m b/ugw/data/preprocess.m index a43578d..ef729fd 100755 --- a/ugw/data/preprocess.m +++ b/ugw/data/preprocess.m @@ -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, -- 2.39.2