-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualize.cpp
More file actions
59 lines (48 loc) · 2.31 KB
/
Visualize.cpp
File metadata and controls
59 lines (48 loc) · 2.31 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
/*****************************************************************************************************************
** The goal is to read different files (txt or csv) and to visulize the data **
*****************************************************************************************************************
** Sources: **
** 1. https://www.youtube.com/watch?v=TSRdO0AH9Gc **
** 2. https://www.geeksforgeeks.org/csv-file-management-using-c/ **
** 3. https://towardsdatascience.com/data-preprocessing-and-visualization-in-c-6d97ed236f3b **
** 4. https://stackoverflow.com/questions/5449407/calculating-sums-of-columns-in-csv-file-using-c **
** 5. https://stackoverflow.com/questions/34218040/how-to-read-a-csv-file-data-into-an-array **
****************************************************************************************************************/
#include <iostream>
#include <fstream>
#include <string>
#include "Visualize.hpp"
using namespace std;
void CSV :: visualize_csv(){
}
//Right know we can only read data from the file fake_coordinates.
void TXT :: read_txt_file(string myFilePath){
ifstream coordinates;
coordinates.open(myFilePath); //open a file to perform read operation
if(coordinates.fail()){
cerr << "Unable to open file" << myFilePath << endl; //checking whether the file is open
}
string coordinate;
while(getline(coordinates, coordinate)){ //read data from file object and put it into string.
cout << coordinate << endl; // prints the data
}
coordinates.close(); //close the file object.
}
void TXT :: visualize_txt(){
}
void CSV :: read_corr_file(){
std::ifstream data("fake-corr-chart");
std::string line;
std::vector<std::vector<std::string> > read_corr_file;
while(std::getline(data,line))
{
std::stringstream lineStream(line);
std::string cell;
std::vector<std::string> corrRow;
while(std::getline(lineStream,cell,','))
{
corrRow.push_back(cell);
}
read_corr_file.push_back(corrRow);
}
};