2

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.

Lee Sai Mun
  • 140
  • 3
  • 13
  • The armadillo matrix should simply be a vector where each element is equivalent to a row. – Lee Sai Mun Nov 19 '18 at 03:41
  • I need to do something similar to this but the inverse. https://stackoverflow.com/questions/29088809/how-do-i-convert-an-armadillo-matrix-to-a-vector-of-vectors/53369056?noredirect=1#comment93614422_53369056 – Lee Sai Mun Nov 19 '18 at 06:08

1 Answers1

5

I think you can use:

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

if your vector is an std vector.

Amit Rotem
  • 66
  • 1