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