Skip to content

Commit

Permalink
Offline analysis tool
Browse files Browse the repository at this point in the history
  • Loading branch information
itkovian committed Nov 28, 2011
1 parent c50e5f0 commit b6e35ca
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions analyse/OfflineAnalysis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* (C) 2011, Andy Georges
*
* Dit programma zal de data die uit de StepCounter wordt
* gehaald (/sdcard/accelDataLog) inlezen en verwerken.
*
*/


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;


class OfflineAnalysis {

private static double [][] samples = null;

/* print out the first three lines and the last line of
* the datafile for checking purposes
*/
public static void checkData() {


}




public static void main(String [] args) {

if(args.length != 1) {
System.err.println("You must provide a file with the relevant data!");
System.err.println("Usage: OfflineAnalysis" + " <file>");
System.exit(-1);
}

BufferedReader r = null;
try {
r = new BufferedReader(new FileReader(args[0]));
}
catch(FileNotFoundException e) {
System.err.println("Oops!");
System.err.println(e);
System.exit(-1);
}
ArrayList<double[]> samplesA = new ArrayList();

try {
for(String l = r.readLine(); l != null; l = r.readLine()) {
String [] fields = l.split(":");
double [] s = { Double.parseDouble(fields[0]), Double.parseDouble(fields[2]), Double.parseDouble(fields[3]), Double.parseDouble(fields[4]) };
samplesA.add(s);
}
r.close();
}
catch(IOException e) {
System.err.println("Oops");
System.err.println(e);
System.exit(-1);

}
samples = samplesA.toArray(new double [samplesA.size()][]);
}

}

0 comments on commit b6e35ca

Please sign in to comment.