I was wondering if there is a way to convert an Armadillo vector to a std string. For example if I have this vector:
arma::vec myvec("1 2 3"); //create a vector of length 3
How can I produce:
std::string mystring("1 2 3");
from it?
I was wondering if there is a way to convert an Armadillo vector to a std string. For example if I have this vector:
arma::vec myvec("1 2 3"); //create a vector of length 3
How can I produce:
std::string mystring("1 2 3");
from it?
Use a combination of ostringstream, .raw_print(), .st(), .substr(), as below.
If you want to change the formatting, look into fmtflags: