#include <CSV_fwd.hpp>
Implements support for basic CSV I/O.
Definition at line 35 of file CSV_fwd.hpp.
Static Public Member Functions | |
static std::vector< double > | read (const std::string &filename) |
Reads a CSV file to a vector of doubles. More... | |
static std::vector< std::vector< double > > | read2d (const std::string &filename, char separator=',') |
Reads a CSV file to a vector of vectors of doubles. More... | |
static Eigen::Matrix< double, -1, -1, 0, -1, -1 > | readEigen (const std::string &filename, char separator=',') |
Reads a CSV file to an Eigen matrix. More... | |
template<typename arr_t > | |
static void | write (const std::string &filename, const arr_t &array) |
Writes given array to a CSV file (as a column). More... | |
template<typename arr_t > | |
static void | write2d (const std::string &filename, const arr_t &array, char separator=',') |
Writes given 2d array to a CSV file. More... | |
template<typename Derived > | |
static void | writeEigen (const std::string &filename, const Eigen::MatrixBase< Derived > &expr, char separator=',') |
Writes given Eigen matrix to a CSV file. More... | |
Static Private Member Functions | |
static std::vector< std::string > | split (const std::string &str, char separator) |
Splits given string into a vector of strings on the given separator. More... | |
|
static |
Reads a CSV file to a vector of doubles.
The file must have one number per line, otherwise use CSV::read2d.
filename | Path to the CSV file. |
Assertion | fails if file cannot be read or if it is malformed. |
|
static |
|
inlinestatic |
Reads a CSV file to an Eigen matrix.
Assertion | fails if file cannot be read or if it is malformed. |
Definition at line 14 of file CSV_Eigen.hpp.
|
staticprivate |
|
static |
Writes given array to a CSV file (as a column).
filename | Path to the CSV file. |
array | One dimensional array of data that supports range for loop iteration. |
Assertion | fails if file cannot be written to. |
|
static |
Writes given 2d array to a CSV file.
filename | Path to the CSV file. |
array | Two dimensional array of data that supports two nested range for loop iterations. |
separator | Character to use as a separator in a CSV file. |
Assertion | fails if file cannot be written to. |
|
static |
Writes given Eigen matrix to a CSV file.
filename | Path to the CSV file. |
expr | An Eigen expression that can be evaluated to a matrix. |
separator | Character to use as a separator in a CSV file. |
Assertion | fails if file cannot be written to. |
Definition at line 44 of file CSV_Eigen.hpp.