/// <summary> /// For given selected columns and selected rows, the procedure removes all nonnumeric cells. Furthermore, if either selectedColumns or selectedRows /// is empty, the collection is filled by the really used rows/columns. /// </summary> /// <param name="srctable">The source table.</param> /// <param name="selectedRows">On entry, contains the selectedRows (or empty if now rows selected). On output, is the row collection.</param> /// <param name="selectedColumns">On entry, conains the selected columns (or emtpy if only rows selected). On output, contains all numeric columns.</param> public static void RemoveNonNumericCells(Altaxo.Data.DataTable srctable, Altaxo.Collections.AscendingIntegerCollection selectedRows, Altaxo.Collections.AscendingIntegerCollection selectedColumns) { // first the columns if (0 != selectedColumns.Count) { for (int i = 0; i < selectedColumns.Count; i++) { int idx = selectedColumns[i]; if (!(srctable[idx] is Altaxo.Data.INumericColumn)) { selectedColumns.Remove(idx); } } } else // if no columns where selected, select all that are numeric { int end = srctable.DataColumnCount; for (int i = 0; i < end; i++) { if (srctable[i] is Altaxo.Data.INumericColumn) selectedColumns.Add(i); } } // if now rows selected, then test the max row count of the selected columns // and add it // check the number of rows if (0 == selectedRows.Count) { int numrows = 0; int end = selectedColumns.Count; for (int i = 0; i < end; i++) { int idx = selectedColumns[i]; numrows = Math.Max(numrows, srctable[idx].Count); } selectedRows.Add(ContiguousIntegerRange.FromStartAndCount(0, numrows)); } }