Append column to matrix, using Eigen library

后端 未结 1 743
傲寒
傲寒 2020-12-30 06:25

It\'s quite a simple task, but I was not able to find an answer to it:

Using the Eigen library, suppose I have Matrix2Xd mat and Vector2d vec

1条回答
  •  旧时难觅i
    2020-12-30 07:17

    You can use conservativeResize for that purpose:

    mat.conservativeResize(mat.rows(), mat.cols()+1);
    mat.col(mat.cols()-1) = vec;
    

    0 讨论(0)
提交回复
热议问题