Closed afoster28 closed 7 months ago
Nice initial version. I'm getting the following error:
An error occurred: stod
Can you make the inputs dynamic, i.e. ask the user to provide the name of the model output and expected output?
Change result to decimal instead of * 100 and limit to 2 decimal places
Doesn't compile - please check
Enter the name of the model output CSV file: result_matrix.csv Enter the name of the expected output CSV file: output_small.txt Error converting string to double: stod Error converting string to double: stod Error converting string to double: stod Error converting string to double: stod Error converting string to double: stod Error converting string to double: stod Difference matrix has been saved to difference_matrix.csv
// Improved readMatrixFromCSV (tried to handle errors) needs integrating
std::vector<std::vector
while (std::getline(file, line)) {
std::vector<double> row;
std::istringstream ss(line);
std::string value;
while (std::getline(ss, value, ',')) {
try {
row.push_back(std::stod(value));
} catch (const std::invalid_argument& ia) {
// Handling or logging invalid argument error
continue; // Skipping this value
}
}
matrix.push_back(row);
}
return matrix;
}
int main() { std::string inputFilename, expectedFilename; std::cout << "Enter the input CSV filename: "; std::cin >> inputFilename; std::cout << "Enter the expected output filename: "; std::cin >> expectedFilename;
// Use these filenames where needed in the rest of opt_v9
}
Still doesn't compile - can you fix and upload the entire script?
Having trouble with the error:
Enter model output file name: result_matrix.csv Enter expected output file name: output_small.txt terminate called after throwing an instance of 'std::invalid_argument' what(): stod
Formatting_Differencing.txt