Changeset 8530 for trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV
- Timestamp:
- 08/28/12 11:48:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs
r8211 r8530 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Globalization; 24 25 using System.IO; 25 26 using System.Linq; … … 86 87 } 87 88 public override void ExportData(IClassificationProblemData instance, string path) { 88 StringBuilder strBuilder = new StringBuilder();89 var strBuilder = new StringBuilder(); 89 90 90 91 foreach (var variable in instance.InputVariables) { 91 strBuilder.Append(variable + ";");92 strBuilder.Append(variable + CultureInfo.CurrentCulture.TextInfo.ListSeparator); 92 93 } 93 strBuilder.Remove(strBuilder.Length - 1, 1);94 strBuilder.Remove(strBuilder.Length - CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length, CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length); 94 95 strBuilder.AppendLine(); 95 96 96 Datasetdataset = instance.Dataset;97 var dataset = instance.Dataset; 97 98 98 99 for (int i = 0; i < dataset.Rows; i++) { 99 100 for (int j = 0; j < dataset.Columns; j++) { 100 strBuilder.Append(dataset.GetValue(i, j) + ";"); 101 if (j > 0) strBuilder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator); 102 strBuilder.Append(dataset.GetValue(i, j)); 101 103 } 102 strBuilder.Remove(strBuilder.Length - 1, 1);103 104 strBuilder.AppendLine(); 104 105 } 105 106 106 using ( StreamWriter writer = new StreamWriter(path)) {107 using (var writer = new StreamWriter(path)) { 107 108 writer.Write(strBuilder); 108 109 }
Note: See TracChangeset
for help on using the changeset viewer.