Changeset 345 for branches/3.0/sources/HeuristicLab.DataAnalysis
- Timestamp:
- 06/26/08 15:30:16 (16 years ago)
- Location:
- branches/3.0/sources/HeuristicLab.DataAnalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/sources/HeuristicLab.DataAnalysis/Dataset.cs
r278 r345 66 66 public double[] Samples { 67 67 get { return samples; } 68 set { 68 set { 69 69 samples = value; 70 70 CreateDictionaries(); … … 81 81 public Dataset() { 82 82 Name = "-"; 83 VariableNames = new string[] { "Var0"};83 VariableNames = new string[] { "Var0" }; 84 84 Columns = 1; 85 85 Rows = 1; … … 146 146 rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 147 147 columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 148 148 149 149 VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value); 150 150 … … 154 154 for(int row = 0; row < rows; row++) { 155 155 for(int column = 0; column < columns; column++) { 156 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row *columns + column]) == false) {156 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 157 157 throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 158 158 } … … 171 171 for(int column = 0; column < columns; column++) { 172 172 builder.Append(";"); 173 builder.Append(samples[row *columns+column].ToString(format));173 builder.Append(samples[row * columns + column].ToString("r",format)); 174 174 } 175 175 } … … 180 180 private string GetVariableNamesString() { 181 181 string s = ""; 182 for 182 for(int i = 0; i < variableNames.Length; i++) { 183 183 s += variableNames[i] + "; "; 184 184 } 185 185 186 if 186 if(variableNames.Length > 0) { 187 187 s = s.TrimEnd(';', ' '); 188 188 } … … 192 192 private string[] ParseVariableNamesString(string p) { 193 193 p = p.Trim(); 194 string[] tokens = p.Split(new char[] { ';'}, StringSplitOptions.RemoveEmptyEntries);194 string[] tokens = p.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 195 195 return tokens; 196 196 } 197 197 198 198 public double GetMean(int column) { 199 return GetMean(column, 0, Rows -1);199 return GetMean(column, 0, Rows - 1); 200 200 } 201 201 … … 216 216 217 217 public double GetRange(int column) { 218 return GetRange(column, 0, Rows -1);218 return GetRange(column, 0, Rows - 1); 219 219 } 220 220 -
branches/3.0/sources/HeuristicLab.DataAnalysis/DatasetView.cs
r278 r345 41 41 InitializeComponent(); 42 42 openFileDialog = new OpenFileDialog(); 43 44 dataGridView.DefaultCellStyle.Format = "r"; 43 45 } 44 46
Note: See TracChangeset
for help on using the changeset viewer.