コード例 #1
0
 void export_Split()
 {
     try
     {
         int aa_start = TheTool.getInt(txtAAstart);
         int aa_range = TheTool.getInt(txtAARange);
         if (aa_range == 0)
         {
             checkAutoArrange.IsChecked = false;
         }
         int aa_i     = 0;
         int aa_i_max = TheTool.getPartition(splitter.Count, aa_range);
         //--------
         foreach (int[] split in splitter)
         {
             DataTable dt_split  = TheTool.dataTable_selectRow_byIndex(dataTable, split[0], split[1]);
             string    save_path = TheURL.url_saveFolder;
             if (checkAutoArrange.IsChecked.Value)
             {
                 save_path += @"\" + (aa_start + aa_i);
                 TheTool.Folder_CreateIfMissing(save_path);
             }
             save_path += @"\" + fileName + " (" + split[0] + "-" + split[1] + ").csv";
             TheTool.export_dataTable_to_CSV(save_path, dt_split);
             aa_i++;
             if (aa_i >= aa_i_max)
             {
                 aa_i = 0;
             }
         }
         System.Windows.MessageBox.Show(@"Save to '" + TheURL.url_saveFolder + "'", "Export CSV");
         txtAAstart.Text = (aa_start + aa_i_max).ToString();
     }
     catch (Exception ex) { TheSys.showError(ex); }
 }
コード例 #2
0
        //****************************************************************************************

        public static List <string> calEntropy_MotionData(String path_loadFrom, List <int[]> keyPostureRange
                                                          , int degit, int col_combine_range)
        {
            List <string> final_output = new List <string>();//Data

            try
            {
                DataTable dt = CSVReader.ReadCSVFile(path_loadFrom, true); //prepare Data
                dt = TheTool.dataTable_cropCol(dt, 2, 0);                  //del first 2 Col
                TheTool.dataTable_roundValue(dt, degit);                   // eliminate decimal
                int start = -1; int end = 0;
                foreach (int[] keyPose in keyPostureRange)
                {
                    DataTable dt_sub = TheTool.dataTable_selectRow_byIndex(dt, start, end);
                    final_output.Add(start + " to " + end + "," + calEntrophy_1Action(dt_sub, col_combine_range));
                }
            }
            catch (Exception ex) { TheSys.showError(ex); }
            return(final_output);
        }