static void exportMatlabTest()
        {
            UAVObjectManager mgr = new UAVObjectManager();
            UAVObjectsInitialize.register(mgr);
            UavLogReader rd = new UavLogReader(mgr);
            var data = rd.parseFile(@"C:\Users\mimmo\Desktop\xports\OP-2014-01-13_22-17-14.opl");

            IEnumerable<AccelSensor> mags = data.OfType<AccelSensor>().Where(k => k.temperature.value < 37);
            var gyro = data.OfType<GyroSensor>().Where(k => k.temperature.value < 37);

            List<MLArray> data1 = new List<MLArray>();
            foreach (var type in data.Select(k => k.GetType()).Distinct().OrderBy(k => k.Name))
            {
                IEnumerable<UAVObject> qq = data.Where(k => k.GetType() == type);
                data1.Add(getStructure(qq, type));
            }

            MatFileWriter mfw = new MatFileWriter(@"C:\Users\mimmo\Desktop\xports\test2.mat", data1, true);
        }
 static void exportMagData()
 {
     UAVObjectManager mgr = new UAVObjectManager();
     UAVObjectsInitialize.register(mgr);
     UavLogReader reader = new UavLogReader(mgr);
     var objects = reader.parseFile(@"C:\OpenPilot\build\openpilotgcs_release\bin\OP-2013-12-31_15-54-42.opl");
     //var objects = reader.parseFile(@"C:\Users\mimmo\Desktop\xports\OP-2014-01-09_23-43-28.opl");
     wr = File.CreateText(@"..\..\output\magdata.csv");
     wr.WriteLine("timestamp;x;y;z;");
     foreach (MagState item in objects.OfType<MagState>().OrderBy(l=>l.timestamp))
     {
         wr.WriteLine("{0};{1};{2};{3};", item.timestamp, item.x.value, item.y.value, item.z.value);
     }
     wr.Close();    
     
 }