-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResultsToCSV.cpp
More file actions
69 lines (56 loc) · 1.4 KB
/
ResultsToCSV.cpp
File metadata and controls
69 lines (56 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <fstream>
using namespace std;
// Function definitions
void readFileAndWriteResults(ifstream&, ofstream&, int);
// Main Program
int main()
{
// Initialize variables
ifstream finLow("LowLevelResults.txt");
ifstream finHigh("HighLevelResults.txt");
ifstream finAll("AllLevelResults.txt");
ofstream fout("NN_Results.csv");
// Read and write
readFileAndWriteResults(finLow, fout, 0);
readFileAndWriteResults(finHigh, fout, 1);
readFileAndWriteResults(finAll, fout, 2);
// Close the files
finLow.close();
finHigh.close();
finAll.close();
fout.close();
// Return
return 0;
}
// Function Implementation
void readFileAndWriteResults(ifstream& fin, ofstream& fout, int tag)
{
// Read the results
char buffer[1024];
for( int i = 0; i < 8; ++i )
{
// Read "Training ..."
fin.getline(buffer, 1024);
// Loop over the 5 iterations
for( int j = 0; j < 5; ++j )
{
// Initialize variables
double value;
// Skip over the confusion matrix
fin.getline(buffer, 1024);
fin.getline(buffer, 1024);
fin.getline(buffer, 1024);
fin.getline(buffer, 1024);
fin.getline(buffer, 1024);
// Read three words and the number
fin >> buffer >> buffer >> buffer;
// Read the value
fin >> value;
// Read the rest of the line
fin.getline(buffer, 1024);
// Write the value out to the file
fout << tag << ' ' << (i * 5) + j << ' ' << value << endl;
}
}
}