[chronojump] better forceSensor csv export



commit 036d56d3c5b5d5aec7a9731290280a6369ad0ce1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 5 13:59:19 2017 +0200

    better forceSensor csv export

 src/gui/forceSensor.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 1dd44e3..78cd1fe 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -131,16 +131,21 @@ public partial class ChronoJumpWindow
 
                Util.CreateForceSensorSessionDirIfNeeded (currentSession.UniqueID);
                string fileName = Util.GetForceSensorSessionDir(currentSession.UniqueID) + 
Path.DirectorySeparatorChar +
-                       currentPerson.Name + "_" + UtilDate.ToFile(DateTime.Now) + ".txt";
+                       currentPerson.Name + "_" + UtilDate.ToFile(DateTime.Now) + ".csv";
 
                TextWriter writer = File.CreateText(fileName);
+               writer.WriteLine("Time (s);Force(N)");
                str = "";
                while(! forceProcessFinish && ! forceProcessCancel)
                {
                        str = port.ReadLine();
-                       writer.WriteLine(str);
                        string [] strFull = str.Split(new char[] {';'});
-                       forceSensorLast = Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
+                       //needed to store double in user locale
+                       double time = Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[0]));
+                       double force = Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
+
+                       writer.WriteLine(time.ToString() + ";" + force.ToString());
+                       forceSensorLast = force;
                }
                port.WriteLine("Stop");
                writer.Flush();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]