private Tuple <QuantityValues, FloatMatrix> getTimeAndAllValuesFor(DataRow row) { var allValuesForQuantity = row[_aggreationName] as IReadOnlyList <QuantityValues>; if (allValuesForQuantity == null || allValuesForQuantity.Count == 0) { return(emptyTimeAndValues()); } var firstQuantityValue = allValuesForQuantity.First(); if (firstQuantityValue.IsNull() || firstQuantityValue.Time.IsNull()) { return(emptyTimeAndValues()); } var matrix = new FloatMatrix(); var time = firstQuantityValue.Time; var length = time.Length; for (int i = 0; i < length; i++) { //values might have different lenght if using different time arrays. We base our arrays on the first time values var values = allValuesForQuantity.Where(qv => i < qv.Length) .Select(qv => qv.ValueAt(i)); matrix.AddValuesAndSort(values); } return(new Tuple <QuantityValues, FloatMatrix>(time, matrix)); }