Search code examples
c++c++11armadillo

How do i convert a vector into armadillo matrix?


I have a vector that contains a list of integers. How do i convert that vector into an armadillo matrix with only 1 column and the number or rows as the length of the vector?

16080
16086
16245
16253
16260
16900
200000

Like this for example.


Solution

  • I think you can use:

    mat A = conv_to<mat>::from(your_vector)
    

    if your vector is an std vector.