In MATLAB, the line below converts a matrix to a vector. It flattens the matrix column by column into a vector.
myvar(:)
How do I do that with Eigen? The solution should work for any dimension of matrix.
MatrixXd A(3,2);
VectorXd B(6);
A << 1,2,3,4,5,6;
B << A.col(0), A.col(1);
//This isn't general enough to work on any size Matrix