Added a new acceptor based on targets in a data file
This commit is contained in:
parent
3f4025d9fb
commit
582f1f4d8b
4 changed files with 52 additions and 16 deletions
|
|
@ -6,7 +6,7 @@
|
|||
//TODO if cols is an empty vector, get all columns from the file
|
||||
//TODO error checking
|
||||
|
||||
Loadtxt::Loadtxt(std::string file_name, std::vector<int> cols)
|
||||
Loadtxt::Loadtxt(std::string file_name, std::vector<int> cols, int skiprows)
|
||||
{
|
||||
std::sort(cols.begin(), cols.end());
|
||||
n_cols = cols.size();
|
||||
|
|
@ -14,7 +14,9 @@ Loadtxt::Loadtxt(std::string file_name, std::vector<int> cols)
|
|||
int n_rows_alloc = tmp_number_of_rows;
|
||||
buffer = (double*)malloc(n_cols * sizeof(double) * n_rows_alloc);
|
||||
std::ifstream file(file_name);
|
||||
if (!file.good()) throw std::runtime_error("Input file not found (" + file_name + ")");
|
||||
std::string line;
|
||||
for (int row = 0; row < skiprows; row++) getline(file, line);
|
||||
int row = -1;
|
||||
while (getline(file, line)) {
|
||||
if (line[line.find_first_not_of(whitespaces)]=='#') continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue