title: Eigen::Matrix3Xd initialization using values from a vector
body: <p>I'm trying to initialize a Eigen::Matrix3Xd with 3D values from a std::vector of an object that saves the x, y and z coordinates, from some code samples I do:</p>
  
  <pre><code>Eigen::Matrix3Xd matRef;
  for (size_t i = 0; i &lt; m_mapReference.size(); i++)
  {
      matRef &lt;&lt; m_mapReference[i].x, m_mapReference[i].y, m_mapReference[i].z;
  }
  </code></pre>
  
  <p>And I have an error in runtime:
  System.NullReferenceException: 'Object reference not set to an instance of an object.'</p>
  
  <p>If I add the size in the constructor of the Matrix3Xd:  </p>
  
  <pre><code>Eigen::Matrix3Xd matRef(10);
  </code></pre>
  
  <p>I have a compile error:<br>
  error C2338: YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX</p>
  
  <p>What am I doing wrong?</p>